diff --git a/automount.sh b/automount.sh index 7ee555c..41b11e4 100755 --- a/automount.sh +++ b/automount.sh @@ -15,29 +15,29 @@ while true; do dev_plug_state="$(lsblk | grep $device)" dev_mount_state="$(mount | grep $device)" - if [ ! -z "$dev_plug_state" ] && [ -z "$dev_mount_state" ]; then + if [ -n "$dev_plug_state" ] && [ -z "$dev_mount_state" ]; then echo "Mount /dev/$device on $mountpoint with options $mountoptions" sudo mount /dev/$device $mountpoint -o $mountoptions echo "Done!" - elif [ ! -z "$dev_plug_state" ] && [ ! -z "$dev_mount_state" ]; then + elif [ -n "$dev_plug_state" ] && [ -n "$dev_mount_state" ]; then echo "/dev/$device is already mounted on $mountpoint" elif [ -z "$dev_plug_state" ] && [ -z "$dev_mount_state" ]; then echo "/dev/$device not plugged in and is not mounted!" - elif [ -z "$dev_plug_state" ] && [ ! -z "$dev_mount_state" ]; then + elif [ -z "$dev_plug_state" ] && [ -n "$dev_mount_state" ]; then echo "/dev/$device is not plugged in and is mounted on $mountpoint" playershstat="$(pgrep $playersh)" - if [ ! -z "$playershstat" ]; then + if [ -n "$playershstat" ]; then echo "Terminating $playersh" pkill $playersh echo "Done!" fi playerstat="$(pgrep $player)" - if [ ! -z "$playerstat" ]; then + if [ -n "$playerstat" ]; then echo "Terminating $player" pkill $player echo "Done!" diff --git a/check_playerproc.sh b/check_playerproc.sh index 7d8b29c..851c4e1 100755 --- a/check_playerproc.sh +++ b/check_playerproc.sh @@ -33,7 +33,7 @@ $gpiocmd write $gpiopin_led_b 0 while true; do - if [ ! -z "$(pgrep $player)" ]; then + if [ -n "$(pgrep $player)" ]; then $gpiocmd write $gpiopin_led_b 1 sleep 0.1 $gpiocmd write $gpiopin_led_b 0 diff --git a/poll_button.sh b/poll_button.sh index 768fb37..1775236 100755 --- a/poll_button.sh +++ b/poll_button.sh @@ -45,7 +45,7 @@ while true; do $gpiocmd mode $gpiopin_led_r out $gpiocmd write $gpiopin_led_g 1 while [ "$($gpiocmd read $gpiopin_sw)" -eq "1" ] && [ "$counter" -lt "$countermax" ]; do - counter="$(($counter + 1))" + counter="$((counter + 1))" #echo "$counter" sleep $buttonpolling done @@ -61,7 +61,7 @@ while true; do $gpiocmd mode $gpiopin_led_r out $gpiocmd write $gpiopin_led_g 1 while [ "$($gpiocmd read $gpiopin_sw)" -eq "1" ] && [ "$counter" -lt "$countermax" ]; do - counter="$(($counter + 1))" + counter="$((counter + 1))" #echo "$counter" sleep $buttonpolling done @@ -77,7 +77,7 @@ while true; do $gpiocmd mode $gpiopin_led_r out $gpiocmd write $gpiopin_led_g 1 while [ "$($gpiocmd read $gpiopin_sw)" -eq "1" ] && [ "$counter" -lt "$countermax" ]; do - counter="$(($counter + 1))" + counter="$((counter + 1))" #echo "$counter" sleep $buttonpolling done diff --git a/randomvideo.sh b/randomvideo.sh index 50f8425..507d0fc 100755 --- a/randomvideo.sh +++ b/randomvideo.sh @@ -37,7 +37,7 @@ while true; do if [ -z "$mountstat" ]; then folder="$folderint" - elif [ ! -z "$mountstat" ]; then + elif [ -n "$mountstat" ]; then folder="$folderext" fi diff --git a/view_birdcam.sh b/view_birdcam.sh index 30b0b44..292fcfe 100755 --- a/view_birdcam.sh +++ b/view_birdcam.sh @@ -37,11 +37,11 @@ streamurl="rtsp://$1:554/user=admin&password=&channel=1&stream=0.sdp?real_stream randomvideosh="/home/pi/birdcam/randomvideo.sh" ### var: path to random video script randomvideoproc="randomvideo.sh" ### var: name of process for random video script -if [ ! -z "$(pgrep $playerproc)" ]; then +if [ -n "$(pgrep $playerproc)" ]; then pkill $playerproc fi -if [ ! -z "$(pgrep $randomvideoproc)" ]; then +if [ -n "$(pgrep $randomvideoproc)" ]; then pkill $randomvideoproc fi