Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I tried to have a switch if either an option is set or not

         while getopts "s:u:d:e:ch" _OPTION; do
         case $_OPTION in
         ...
         c)
                 isCSet="Y"

then I'm calling my function :

myFunction $isCSet

then in my function I'm doing :

echo $1 but I don't have anything in.

How can I solve this problem?

share|improve this question
    
Could you show the exact code you're runnning? And did you try to execute it in verbose mode ( set -x )? –  rush Nov 19 '13 at 11:24

1 Answer 1

up vote 1 down vote accepted

You might be missing to initialize isCSet, eg:

isCSet=N    
while getopts s:u:d:e:ch _OPTION; do
   case $_OPTION in
   ...
   c)
      isCSet=Y;;
   ...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.