Linux Bash shell Scrpt help
I'm trying to make a shell script for a class in college where it will tack to entered arguments and display them on the screen as " Your first argument was ___" and "your Second argument was ____". If more or less then two arguments are entered the program will quit.
So it I entered: ./usage.bash hi there my out put should be: your first argument was hi your second argument was there. Here is what I have so far: #!/bin/bash if [ ] then echo "Your first argument was $1" echo "Your second argument was $2" else exit 127 fi I need to figure out how to test to see if I have two arguments. |
Use $#. It contains the number of arguments.
|
Thank you I just could not remember. Is there a good online resource that might be able to help me with my scripting?
|
Go to tldp.org, search for bash scripting. Google's great, too.
The best guide I've seen is here: http://www.tldp.org/LDP/abs/html/ Honestly, just search around yourself. It's hard not to find good bash documentation. |
All times are GMT -5. The time now is 06:03 AM. |