diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-07-07 23:09:47 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-07-07 23:09:47 +0000 |
commit | a9ca55af4d5cab3052c12f96f9822cfb7f217f8d (patch) | |
tree | 70bc3e121d2abaf949c6696d89f2c927a71bb795 | |
parent | 130b148367040731a6183f12dfa8b6d410ea5f14 (diff) |
Eliminate some $? tests by rolling the command into the condition
ok halex@
-rw-r--r-- | etc/netstart | 8 | ||||
-rw-r--r-- | etc/rc | 5 | ||||
-rw-r--r-- | etc/weekly | 5 |
3 files changed, 7 insertions, 11 deletions
diff --git a/etc/netstart b/etc/netstart index 887844c1005..fa9ab632e2f 100644 --- a/etc/netstart +++ b/etc/netstart @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: netstart,v 1.132 2011/05/26 15:22:53 mpf Exp $ +# $OpenBSD: netstart,v 1.133 2011/07/07 23:09:46 guenther Exp $ # Strip comments (and leading/trailing whitespace if IFS is set) # from a file and spew to stdout @@ -47,11 +47,9 @@ ifstart() { chmod -LR o-rwx $file chown -LR root.wheel $file fi - ifconfig $if > /dev/null 2>&1 - if [ "$?" != "0" ]; then + if ! ifconfig $if > /dev/null 2>&1; then # Try to create interface if it does not exist - ifconfig $if create > /dev/null 2>&1 - if [ "$?" != "0" ]; then + if ! ifconfig $if create > /dev/null 2>&1; then return fi fi @@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.363 2011/07/07 22:57:29 deraadt Exp $ +# $OpenBSD: rc,v 1.364 2011/07/07 23:09:46 guenther Exp $ # System startup script run by init on autoboot # or after single-user. @@ -518,8 +518,7 @@ fi if [ ! -f /etc/motd ]; then install -c -o root -g wheel -m 664 /dev/null /etc/motd fi -T=`mktemp /tmp/_motd.XXXXXXXXXX` -if [ $? -eq 0 ]; then +if T=`mktemp /tmp/_motd.XXXXXXXXXX`; then sysctl -n kern.version | sed 1q > $T echo "" >> $T sed '1,/^$/d' < /etc/motd >> $T diff --git a/etc/weekly b/etc/weekly index ff00fffadee..9e5585aa8a4 100644 --- a/etc/weekly +++ b/etc/weekly @@ -1,5 +1,5 @@ # -# $OpenBSD: weekly,v 1.24 2011/01/19 06:18:05 david Exp $ +# $OpenBSD: weekly,v 1.25 2011/07/07 23:09:46 guenther Exp $ # # For local additions, create the file /etc/weekly.local. # To get section headers, use the function next_part in weekly.local. @@ -45,8 +45,7 @@ run_script "weekly.local" next_part "Rebuilding locate database:" if [ -f /var/db/locate.database ]; then - TMP=`mktemp /var/db/locate.database.XXXXXXXXXX` - if [ $? -eq 0 ]; then + if TMP=`mktemp /var/db/locate.database.XXXXXXXXXX`; then trap 'rm -f $TMP; exit 1' 0 1 15 UPDATEDB="/usr/libexec/locate.updatedb" echo "${UPDATEDB} --fcodes=- --tmpdir=${TMPDIR:-/var/tmp}" | \ |