Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.