2

I don't know what I do wrong, but this code just doesn't work for me:

mode="-P"
select mmode in "default" "fast"; do
    case $mmode in
        default ) break;;
        fast ) mode="-T 2C -P" break;;
    esac
done

echo $mode

The output is always "-P". Somebody please tell me where's the problem, thank you in advance!

1 Answer 1

3

A missing ; causes it. Say:

fast ) mode="-T 2C -P"; break;;
Sign up to request clarification or add additional context in comments.

6 Comments

Oh god I knew it will be a little thing like that :D Thank you for the very fast solution!
@kennyevo ; is not a little thing. It is a command separator :)
var=value cmd is correct but different from var=value; cmd : in the first case, var will only exist for cmd. It is very useful for things like IFS=: read ... or LANG=C file ...
@EdouardThiel You are talking about something completely different.
@devnull in what sense ?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.