I'm extremely new to bash and need to create a script that calls another script depending on what command line switch is taken.
Let's call it stuff.sh
than stuff.sh --help
should behave like help does in a normal program and give a list to the user what he can do
- -a you can do stuff like that.
- -b you can do stuff like that.
- -c this is extremely fancy stuff.
When I execute the script with stuff.sh - a
it should do something, let's say call another script with sudo
in front of it.
How could I do that?
any Ideas that everybody how is new to bash can understand easily?
Thank you!
Best Answer
$0
is the script name.$1
is the first command line argument,$2
is the second, and so on.Read bash manpage for reference.