Regarding Shell variable
Posted
by arav
on Stack Overflow
See other posts from Stack Overflow
or by arav
Published on 2010-06-09T06:22:11Z
Indexed on
2010/06/09
6:22 UTC
Read the original article
Hit count: 229
I need to call another shell script testarg.sh within my main script. This script testarg.sh has arguments ARG1 ,ARG2, ARG3. I need to call up the below way ./testarg.sh -ARG1 -ARG2 -ARG3
ARG1 and ARG3 argument Variables are mandatory ones. If its not passed to the main script then i quit. ARG2 is an optional one. If the ARG2 variable is not set with value or it's not defined then i need not pass it from main script.So i need to call up the below way
./testarg.sh -ARG1 -ARG3
If the value exist for the ARG2 Varibale then i need to call the below way ./testarg.sh -ARG1 -ARG2 -ARG3
Do i need to have a if else statement for checking the ARG2 variable is empty or null. Is there any other way to do it.
© Stack Overflow or respective owner