KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've caught the functional programming bug, so naturally nothing is good enough for me anymore. ;) So, in bash one could write: case $status in "foo") status="bar" ;; "baz") status="buh" ;; *) status=$status ;; esac but I'm afraid of typos, so I'd prefer to write: status=case $status in "foo") "bar" ;; "baz") "buh" ;; *) $status ;; esac The second form is invalid since the case evaluates to the exit code of the last executed command, which is not at all what I'm looking for. Are there easy hacks to achieving what I am looking for?
Tags (comma-separated)
Save Edits
Cancel