crudball wrote:
Code:
#!/bin/bash
var0="`ls`"
var1="$1"
var2="$2"
case "$var1" in
-e ) echo "$var2";;
--echo ) echo "$var2";;
-f ) echo "$var0";;
--file ) echo "$var0";;
* ) echo "please supply a valid option";;
esac
At first i tried to do this with if/elif but it just wasn't working so i googled using case as i never really knew how to use it - so this is a first for me and uisng case will come in useful i feel

.
you can actually make that a little easier too...
Code:
#!/bin/bash
var0="`ls`"
var1="$1"
var2="$2"
case "$var1" in
-e | --echo ) echo "$var2";;
-f | --file ) echo "$var0";;
* ) echo "please supply a valid option";;
esac