Skip to content

Commit

Permalink
simplification for [[ functions in -e mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mpapis committed Jul 4, 2012
1 parent 8dfdd99 commit ae49da6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fun_assign2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -e

do_something() [[ "$1" == "false" || -z "$1" ]]

if x=$(do_something)
then echo "1:succ:$x:$?"
else echo "1:fail:$x:$?"
fi

if x=$(do_something false)
then echo "2:succ:$x:$?"
else echo "2:fail:$x:$?"
fi

if x=$(do_something true)
then echo "3:succ:$x:$?"
else echo "3:fail:$x:$?"
fi

0 comments on commit ae49da6

Please sign in to comment.