diff --git a/benchmarks/cryptsetup_benchmark.sh b/benchmarks/cryptsetup_benchmark.sh index 677dee9..503447b 100755 --- a/benchmarks/cryptsetup_benchmark.sh +++ b/benchmarks/cryptsetup_benchmark.sh @@ -6,7 +6,7 @@ # DEBUG=echo -if [ ! -b "$1" -o -z "$4" ]; then +if [ ! -b "$1" ] || [ -z "$4" ]; then echo "Usage: $0 [device] [cipher] [size] [runs]" echo "Examples:" echo "`basename $0` /dev/sdu1 aes-cbc-plain 128" diff --git a/benchmarks/fs-bench.sh b/benchmarks/fs-bench.sh index 243d5c0..7e55095 100755 --- a/benchmarks/fs-bench.sh +++ b/benchmarks/fs-bench.sh @@ -53,7 +53,7 @@ fi } # sanity checks -if [ ! -b "$1" -o ! -d "$2" -o ! -f $CONF ]; then +if [ ! -b "$1" ] || [ ! -d "$2" ] || [ ! -f $CONF ]; then log "Usage: `basename $0` [dev] [mpt]" log "Make sure $CONF exists!" 1 else @@ -189,7 +189,7 @@ umountfs() { case $fs in zfs) # ...and special case Linux/ZFS again - if [ "`uname -s`" = Linux -a -z "`pgrep zfs-fuse`" ]; then + if [ "`uname -s`" = Linux ] && [ -z "`pgrep zfs-fuse`" ]; then log "zfs-fuse not running!" 1 fi $DEBUG sync @@ -403,7 +403,7 @@ GEN_END=$(date +%s) GEN_DUR=`echo "scale=2; $GEN_END - $GEN_BEGIN" | bc -l` NUMDIRS_C=`find $MPT/manyfiles -type d | wc -l` NUMFILES_C=`find $MPT/manyfiles -type f | wc -l` -[ `expr $NUMDIRS_C - 1` = $NUMDIRS -a $NUMFILES_C = `expr $NUMDIRS \* $NUMFILES` ] || ERR="- FAILED" +[ `expr $NUMDIRS_C - 1` = $NUMDIRS ] && [ $NUMFILES_C = `expr $NUMDIRS \* $NUMFILES` ] || ERR="- FAILED" log "$FSP.4: $GEN_DUR seconds to create $NUMFILES files in each of the $NUMDIRS directories $ERR" >> $LOG/raw/generic-$fs.log ERR="" @@ -436,7 +436,7 @@ GEN_END=$(date +%s) GEN_DUR=`echo "scale=2; $GEN_END - $GEN_BEGIN" | bc -l` NUMDIRS_C=`find $MPT/manydirs -type d | wc -l` NUMFILES_C=`find $MPT/manydirs -type f | wc -l` -[ `expr $NUMDIRS_C - 1` = $NUMFILES -a $NUMFILES_C = `expr $NUMDIRS \* $NUMFILES` ] || ERR="- FAILED" +[ `expr $NUMDIRS_C - 1` = $NUMFILES ] && [ $NUMFILES_C = `expr $NUMDIRS \* $NUMFILES` ] || ERR="- FAILED" log "$FSP.6: $GEN_DUR seconds to create $NUMDIRS files in each of the $NUMFILES directories $ERR" >> $LOG/raw/generic-$fs.log ERR="" diff --git a/benchmarks/ssh-performance.sh b/benchmarks/ssh-performance.sh index 6e72b60..241c2e3 100755 --- a/benchmarks/ssh-performance.sh +++ b/benchmarks/ssh-performance.sh @@ -8,7 +8,7 @@ # # The ssh-eval.log must be created with ssh-features.sh. # -if [ ! -f "$1" -o $# -ne 3 ]; then +if [ ! -f "$1" ] || [ $# -ne 3 ]; then echo "Usage: $(basename $0) [ssh-eval.log] [user@][host] [size-in-MB]" exit 1 else diff --git a/checksum_file.sh b/checksum_file.sh index 7d133cb..094c2b9 100755 --- a/checksum_file.sh +++ b/checksum_file.sh @@ -39,7 +39,7 @@ print_usage() echo " `basename $0` [remove] [file]" } -if [ $# -ne 2 -o ! -f "$2" ]; then +if [ $# -ne 2 ] || [ ! -f "$2" ]; then print_usage exit 1 else diff --git a/convert-music.sh b/convert-music.sh index ff25813..bad27b9 100755 --- a/convert-music.sh +++ b/convert-music.sh @@ -20,7 +20,7 @@ # Convert Flac to Mp3 # https://wiki.archlinux.org/index.php/Convert_Flac_to_Mp3 # -if [ ! $# -eq 2 -o ! -f "$2" ]; then +if [ ! $# -eq 2 ] || [ ! -f "$2" ]; then echo "Usage: `basename $0` [conversion] [file]" echo "Conversions: flac2mp3, m4a2mp3, ogg2mp3" exit 1 @@ -86,7 +86,7 @@ case $CONVERSION in OUTPUT=${FILE%.ogg}.mp3 eval `ogginfo -qv "$FILE" | awk '/ARTIST/ || /TITLE/' | sed 's/^ //'` # echo "ARTIST: $ARTIST TITLE: $TITLE" - if [ -z "$ARTIST" -o -z "$TITLE" ]; then + if [ -z "$ARTIST" ] || [ -z "$TITLE" ]; then echo "WARNING: Not enough metadata, trying to gather track information from filename! ($FILE)" TRACK=$(ls "$FILE" | awk -F\ '{print $1}') TITLE=$(ls "$FILE" | sed 's/^[0-9]* - //;s/\.ogg//') diff --git a/funiq.sh b/funiq.sh index 0bf7ca2..d46714f 100755 --- a/funiq.sh +++ b/funiq.sh @@ -4,13 +4,12 @@ # Fuzzy uniq (or Parsing Connect:Direct stats part 3) # http://cdunix.blogspot.com/2008/10/fuzzy-uniq-or-parsing-connectdirect.html # -# Get percentage of similarity from -s command line option, or 85 for default +# Get percentage of similarity from command line option, or 85 for default # # Percentage of similarity -if [ "$1" = "-s" -a -n "$2" ]; then - SIM=$2 - shift 2 +if [ -n "$1" ]; then + SIM=$1 else SIM=85 fi diff --git a/kerninst.sh b/kerninst.sh index 44170c0..6839a93 100755 --- a/kerninst.sh +++ b/kerninst.sh @@ -55,7 +55,7 @@ else fi # We might specify a build directory -if [ -d "$2" -a -x "$2"/vmlinux ]; then +if [ -d "$2" ] && [ -x "$2"/vmlinux ]; then BUILDDIR="$2" OPTIONS="O=$BUILDDIR" diff --git a/rsnapshot/rsnapshot-wrapper.sh b/rsnapshot/rsnapshot-wrapper.sh index efaacf7..b7eeb4e 100755 --- a/rsnapshot/rsnapshot-wrapper.sh +++ b/rsnapshot/rsnapshot-wrapper.sh @@ -165,7 +165,7 @@ else . "$CONF" # We need these to run - if [ ! -d "$CONFDIR" -o -z "$LOG" -o -z "$PIDFILE" ]; then + if [ ! -d "$CONFDIR" ] || [ -z "$LOG" ] || [ -z "$PIDFILE" ]; then log "**** Please check CONFDIR, LOG, PIDFILE in $CONF!" 1 fi diff --git a/security_checks.sh b/security_checks.sh index a1ac195..84c0536 100755 --- a/security_checks.sh +++ b/security_checks.sh @@ -14,7 +14,7 @@ MAXAGE=7 # DEBUG=echo # BTS# 231267 -if [ -f "$STATE" -a ! -L "$STATE" ]; then +if [ -f "$STATE" ] && [ ! -L "$STATE" ]; then : else $DEBUG rm -f "$STATE"