Results 1 to 3 of 3
So I'm learning the shell off of linuxcommand .org and I am stuck on positional parameters, I am stuck here...
Command line options
As we discussed before, many programs, particularly ...
- 10-02-2011 #1Just Joined!
- Join Date
- Sep 2011
- Posts
- 4
Positional Parameters help
So I'm learning the shell off of linuxcommand .org and I am stuck on positional parameters, I am stuck here...
Command line options
As we discussed before, many programs, particularly ones from the GNU Project, support both short and long command line options. For example, to display a help message for many of these programs, you may use either the "-h" option or the longer "--help" option. Long option names are typically preceded by a double dash. We will adopt this convention for our scripts.
Here is the code we will use to process our command line:
interactive=
filename=~/system_page.html
while [ "$1" != "" ]; do
case $1 in
-f | --file ) shift
filename=$1
;;
-i | --interactive ) interactive=1
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
I tried putting #!/bin/bash on the top to get the bash to run it and also tried putting a file where it says system_page.html but nothing, some elaboration would be great, thanks.
- 10-02-2011 #2
What is your question? What are you trying to do? What error message are you getting?
DISTRO=Arch
Registered Linux User #388732
- 10-02-2011 #3Just Joined!
- Join Date
- Sep 2011
- Posts
- 4
Sorry I misunderstood what the lesson was telling me and I figured it out, thanks anyways!


Reply With Quote