-1

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?

Hussain
  • 633
  • 1
  • 16
  • 26

1 Answers1

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