Option not recognized

前端 未结 1 412
耶瑟儿~
耶瑟儿~ 2020-12-07 05:04

I\'m trying to use a case statement to determine if I have a legal command. It looks something like this:

function commandTest {
    case $1 in
    –score) e         


        
1条回答
  •  [愿得一人]
    2020-12-07 05:32

    As posted, your sample code has an en-dash (Unicode U+2013) in front of score, instead of a minus sign (ASCII 0x2D), which is preventing bash from matching the string -score

    Switch:

    –score) echo "something" 
    

    to:

    -score) echo "something" 
    

    0 讨论(0)
提交回复
热议问题