|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
decipher shell commands
Hi Guys, I am busy trying to re-write a shell script that was written way back. I need help with these codes: Code:
# Process switches if [ $? -gt 1 ] ; then echo "usage : process <optional instance>" exit 99 fi What does the above code mean? What does these $? -gt 1 mean? Then I have these--- Code:
SIDA=true
SIDB=true
if [ $# -eq 1 ] ; then
if [ $1 = "SIDA" ] ; then
SIDB=false
fi
if [ $1 = "SIDB" ] ; then
SIDA=false
fi
fiWhat does these mean? What does $ mean in shell scripting and where can I learn more about using this in my scripts? Thanks in advance.... Last edited by Scott; 07-31-2012 at 04:17 AM.. Reason: Code tags, please... |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
The $ sign expands (=replaces) parameters/variables to (with) their contents. 1, 2, ... are positional parameters, of which $# is the count; $? yields the exit code/status of your last command. Read the man page of your shell.
|
|
#4
|
|||
|
|||
|
Thanks for the replies...
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| can you decipher this script ? | llcooljatt | SuSE | 7 | 12-10-2011 07:57 AM |
| Can you decipher this script ? | llcooljatt | Shell Programming and Scripting | 1 | 11-01-2011 07:48 AM |
| Sed - Unable to decipher this. | sid1982 | Shell Programming and Scripting | 6 | 02-17-2010 03:07 PM |
| Can BASH execute commands on a remote server when the commands are embedded in shell | bash_in_my_head | Shell Programming and Scripting | 1 | 12-04-2008 12:51 AM |
| help me decipher how much memory on my box | JamesByars | HP-UX | 3 | 10-17-2008 08:18 PM |
|
|