Permalink
Browse files

use direct if, not $? -eq 0

  • Loading branch information...
pbrisbin committed Dec 8, 2011
1 parent ede46d4 commit 94cc898990ec2ea627ddc14e971b258537de7369
Showing with 8 additions and 9 deletions.
  1. +8 −9 wifi-pipe
View
@@ -94,16 +94,15 @@ connect() {
fi
# connect
- /usr/bin/netcfg "$profile" > /tmp/output.tmp
+ if !/usr/bin/netcfg "$profile" > /tmp/output.tmp; then
- # if failed, ask about removal of created profile
- if [[ $? -ne 0 ]]; then
- zenity --question \
- --title="Connection failed" \
- --text="$(grep -Eo "[\-\>]\ .*$" /tmp/output.tmp) \n Remove $profile_file?" \
- --ok-label="Remove profile"
-
- [[ $? -eq 0 ]] && rm "$profile_file"
+ # failed, ask about removal of created profile
+ if zenity --question --title="Connection failed" \
+ --text="$(grep -Eo "[\-\>]\ .*$" /tmp/output.tmp) \n Remove $profile_file?" \
+ --ok-label="Remove profile"; then
+
+ rm "$profile_file"
+ fi
fi
rm /tmp/output.tmp

0 comments on commit 94cc898

Please sign in to comment.