Hi All,
I am new to scripting. Could you please assist me .
Here is my requirement. I have written a script that has 2 option flags defined.
-l) calls some function with the arguments passed in front of -l
-r) calls second function with the arguments passed in front of -r
*) calls the third function with arguments specified.
For this I have written-
#!/usr/bin/bash
while [ $# -gt 0 ]
do
case "$1" in
-l) echo "$2";
list_files "$2"
shift;;
-r)usage;;
*)if [ "$1" == "." ];then
echo "Not allowed "
else
check_path "$1"
fi
shift ;;
esac
done
######################################
While executing-
Scenario 1- ./test -l file1 file2 file3
I am only able to capture the argument [b]file1 with -l . The arguments file2 and file3 are passed to the *) option.
Could you please let me know how to pass all the arguments to the function called from -l) option.
Thanks a lot