Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Re: problem with script

thanks Sergejs, right on..