faqts : Computers : Operating Systems : Linux : Shell Commands

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

10 of 10 people (100%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

Operating system: Linux: Command line: Variable: How pass command line parameter in batch file? [$]

Nov 23rd, 2003 17:41
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 24 November 2003 - 02:39 am -------------------

Operating system: Linux: Command line: Variable: How pass command line 
parameter in batch file? [$]

---

Use '$'

---

(similar to %1 %2 %3, ... in MSDOS)

---

e.g.

Type on the command line

 alias test='cat $1'

then use this alias via e.g.

 test ddd.dok

---
---

$1 is the first command line parameter

$2 is the second command line parameter

$* is all the command line parameters (e.g. to print a lot of files, 
use
    pr -f -2 $* | lp

----------------------------------------------------------------------