Skip to content

Commit

Permalink
Don't run exit: it exits ZSH
Browse files Browse the repository at this point in the history
  • Loading branch information
malthejorgensen committed Nov 20, 2013
1 parent 7b03a3b commit 2adcf77
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions wd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,25 @@ wd_print_usage()

## run

# get opts
args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*`
args_result=$?

# check if config file is writeable
if [[ ! -w $CONFIG ]]
then
wd_print_msg $RED "\'$CONFIG\' is not writeable. Exiting."
exit 1
fi
# do nothing => exit
# can't run `exit`, as this would exit the executing shell
# i.e. your terminal

# get opts
args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*`

if [[ $? -ne 0 || $#* -eq 0 ]]
# check if no arguments were given
elif [[ $args_result -ne 0 || $#* -eq 0 ]]
then
wd_print_usage
else
# can't exit, as this would exit the excecuting shell
# e.i. your terminal
# do nothing => exit

else
#set -- $args # WTF

for i
Expand Down

0 comments on commit 2adcf77

Please sign in to comment.