problem with script (93 Views)
Reply
Super Advisor
Henry Chua
Posts: 444
Registered: ‎09-05-2004
Message 1 of 3 (93 Views)
Accepted Solution

problem with script

Hi Guys,

I have a queries with scripting:

!#/usr/bin/csh

set a=$1
set b=$2
set c=$3

May I know what does this use of $ sign represent?

Best regards
Henry


Honored Contributor
Sergejs Svitnevs
Posts: 579
Registered: ‎10-02-2002
Message 2 of 3 (93 Views)

Re: problem with script

There are the parameters from the command line.
For example, if you have a script named 'foo', and you want to give it two
parameters, 'X1' and 'X2'. You would type this command:
foo X1 X2

Within the script, '$1' will return the first parameter 'X1', and '$2' will
return the second parameter 'X2'. '$0' returns the command name, 'foo'.

#!/bin/csh -f
echo 'Command:' $0
echo 'Parameters:' $1 $2

Regards,
Sergejs
Super Advisor
Henry Chua
Posts: 444
Registered: ‎09-05-2004
Message 3 of 3 (93 Views)

Re: problem with script

thanks Sergejs, right on..
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.