vendredi 27 février 2015

Unrecoginzed option: using 'getopt' cmd in shell script


What is wrong in the command:



if ! options=$(getopt -n myscript -l a:,b:,cc:,dd:,ee:,ff:,gg:,hh: -- "$@"); then exit 1; fi


I get an error msg:



mhagent: unrecognized option '--hh'
options=' --aa '\''val1'\'' --ibb '\''val2'\'' --cc '\''val4'\'' --dd '\''val4'\'' --ee '\''val5'\'' --ff '\''val6'\'' --gg '\''val7'\'' --'


If I remove the last option: hh, it works fine.



if ! options=$(getopt -n myscript -l a:,b:,cc:,dd:,ee:,ff:,gg: -- "$@"); then exit 1; fi


Aucun commentaire:

Enregistrer un commentaire