1753473 Members
4820 Online
108794 Solutions
New Discussion юеВ

Re: problem with script

 
SOLVED
Go to solution
Henry Chua
Super Advisor

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


2 REPLIES 2
Sergejs Svitnevs
Honored Contributor
Solution

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
Henry Chua
Super Advisor

Re: problem with script

thanks Sergejs, right on..