Hi,
I need help with a script I have to write. I have to take arguments provided by the user and break them up in 2. So if user types:
script_name -S some_string -c some_string -D some_string
I have been so far able to do
fo arg in "$@"
do
val='echo ${arg} |sed -e "s/-[A-Za-z]//"'
case ${arg} in
-a*) .....;;
-C*) .....;;
esac
done
This gives me the string right after the option suppiled, and I can do cut to get the option, then define all uppercase and lowercase characters in my case statement, but that is too long. What I wan to do is take the suppiled iformation such as :
script_name -S some_string -c some_string -D some_string
place the option in one array and the string in another array. This way the user can reference the information from the array at any time and more importantly ANy USER can use this script. I also need to add a counter which will be used to verify the number of actual number of options/commands inputted versus the actual number processed.
I hope some can take time and help me....
TIA
I need help with a script I have to write. I have to take arguments provided by the user and break them up in 2. So if user types:
script_name -S some_string -c some_string -D some_string
I have been so far able to do
fo arg in "$@"
do
val='echo ${arg} |sed -e "s/-[A-Za-z]//"'
case ${arg} in
-a*) .....;;
-C*) .....;;
esac
done
This gives me the string right after the option suppiled, and I can do cut to get the option, then define all uppercase and lowercase characters in my case statement, but that is too long. What I wan to do is take the suppiled iformation such as :
script_name -S some_string -c some_string -D some_string
place the option in one array and the string in another array. This way the user can reference the information from the array at any time and more importantly ANy USER can use this script. I also need to add a counter which will be used to verify the number of actual number of options/commands inputted versus the actual number processed.
I hope some can take time and help me....
TIA