Skip to main content
edited title
Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 237

getopts Unix helpinput

deleted 6 characters in body
Source Link
Bob
  • 1
  • 1

so in my code below I'm like trying to get my code to read the input that the user enters in my code as seen below

#./MyProject -a -b OR -b -a

However I keep getting a Syntax error and its not passing the tests given by the program: The following tests are: having inputs that aren't a&b (i.e c-z), having no inputs at all, having too little arguments, having too many arguments,

#Usage#Use just prints out the format like this : ./MyProject -a -b

 - if ( ! getopts ":ot"ab" arg) then  
echo $USAGE$use  
fi 
  
 while [getopts ":to"ab" arg2] 
do
         case $arg2 in

        t) if (($1 != "t" && $1 != "o")); then
         echo $USAGE$use 
     fi   
 esac   
done  
}

so in my code below I'm like trying to get my code to read the input that the user enters in my code as seen below

#./MyProject -a -b OR -b -a

However I keep getting a Syntax error and its not passing the tests given by the program: The following tests are: having inputs that aren't a&b (i.e c-z), having no inputs at all, having too little arguments, having too many arguments,

#Usage just prints out the format like this : ./MyProject -a -b

 - if ( ! getopts ":ot" arg) then  
echo $USAGE  
fi 
  
 while [getopts ":to" arg2] 
do
         case $arg2 in

        t) if (($1 != "t" && $1 != "o")); then
         echo $USAGE 
     fi   
 esac   
done  
}

so in my code below I'm like trying to get my code to read the input that the user enters in my code as seen below

#./MyProject -a -b OR -b -a

However I keep getting a Syntax error and its not passing the tests given by the program: The following tests are: having inputs that aren't a&b (i.e c-z), having no inputs at all, having too little arguments, having too many arguments,

#Use just prints out the format like this : ./MyProject -a -b

 - if ( ! getopts ":ab" arg) then  
echo $use  
fi 
  
 while [getopts ":ab" arg2] 
do
         case $arg2 in

        t) if (($1 != "t" && $1 != "o")); then
         echo $use 
     fi   
 esac   
done  
}
added 68 characters in body
Source Link
daisy
  • 55.9k
  • 80
  • 253
  • 402

#Hi everyone, so in my code below I'm like trying to get my code to read the input that the user enters in my code as seen below

#./MyProject -a -b OR -b -a

#./MyProject -a -b OR -b -a

#HoweverHowever I keep getting a Syntax error and its not passing the tests given by the program: The following tests are: having inputs that aren't a&b (i.e c-z), having no inputs at all, having too little arguments, having too many arguments,

#Usage just prints out the format like this : ./MyProject -a -b

  • if ( ! getopts ":ot" arg) then
    echo $USAGE
    fi

while [getopts ":to" arg2] do case $arg2 in

#Usage just prints out the format like this : ./MyProject -a -b

 - if ( ! getopts ":ot" arg) then  
echo $USAGE  
fi 
   
 while [getopts ":to" arg2] 
do
         case $arg2 in

        t) if (($1 != "t" && $1 != "o")); then
         echo $USAGE 
     fi   
 esac   
done  
}

esac
done
}

#Hi everyone, so in my code below I'm like trying to get my code to read the input that the user enters in my code as seen below

#./MyProject -a -b OR -b -a

#However I keep getting a Syntax error and its not passing the tests given by the program: The following tests are: having inputs that aren't a&b (i.e c-z), having no inputs at all, having too little arguments, having too many arguments,

#Usage just prints out the format like this : ./MyProject -a -b

  • if ( ! getopts ":ot" arg) then
    echo $USAGE
    fi

while [getopts ":to" arg2] do case $arg2 in

    t) if (($1 != "t" && $1 != "o")); then
     echo $USAGE 
 fi   

esac
done
}

so in my code below I'm like trying to get my code to read the input that the user enters in my code as seen below

#./MyProject -a -b OR -b -a

However I keep getting a Syntax error and its not passing the tests given by the program: The following tests are: having inputs that aren't a&b (i.e c-z), having no inputs at all, having too little arguments, having too many arguments,

#Usage just prints out the format like this : ./MyProject -a -b

 - if ( ! getopts ":ot" arg) then  
echo $USAGE  
fi 
   
 while [getopts ":to" arg2] 
do
         case $arg2 in

        t) if (($1 != "t" && $1 != "o")); then
         echo $USAGE 
     fi   
 esac   
done  
}
Source Link
Bob
  • 1
  • 1
Loading