I have a command that generates two possible outputs ('dis' and 'en'). I want to pipe it into another command that switches one to the other ('dis' -> 'en', 'en' -> 'dis'). What's the simplest way to do this?
Asked
Active
Viewed 24 times
1 Answers
1
Untested, but should work:
result=`myCommand`
if [ $result = 'dis' ]; then
output='en'
elif [ $result = 'en' ]; then
output='dis'
fi

Zev Eisenberg
- 8,080
- 5
- 38
- 82