use -z to check if a string is empty or not
Previously I used: [[ $STRING == "" ]] && do_something To check if a string was empty or not, but this can be simplified a lot by writing: [ -z $STRING ] && do_something
This commit is contained in:
parent
791f26fe54
commit
01dbabf5a1
12
kunst
12
kunst
|
@ -183,9 +183,9 @@ pre_exit() {
|
|||
|
||||
main() {
|
||||
|
||||
[[ $KUNST_MUSIC_DIR != "" ]] && MUSIC_DIR=$KUNST_MUSIC_DIR
|
||||
[[ $KUNST_SIZE != "" ]] && SIZE=$KUNST_SIZE
|
||||
[[ $KUNST_POSITION != "" ]] && POSITION=$KUNST_POSITION
|
||||
[ -z $KUNST_MUSIC_DIR ] && MUSIC_DIR=$KUNST_MUSIC_DIR
|
||||
[ -z $KUNST_SIZE ] && SIZE=$KUNST_SIZE
|
||||
[ -z $KUNST_POSITION ] && POSITION=$KUNST_POSITION
|
||||
|
||||
# Flag to run some commands only once in the loop
|
||||
FIRST_RUN=true
|
||||
|
@ -231,9 +231,9 @@ main() {
|
|||
while true; do
|
||||
mpc idle player &>/dev/null && (mpc status | grep "\[playing\]" &>/dev/null) && break
|
||||
done
|
||||
if [ ! $SILENT ]; then
|
||||
echo "kunst: received event from mpd"
|
||||
fi
|
||||
|
||||
[ ! $SILENT ] && echo "kunst: received event from mpd"
|
||||
|
||||
if [ "$VIEWER" = 'imv' ]; then
|
||||
imv-msg "$(cat /tmp/kunst.pid)" close all
|
||||
imv-msg "$(cat /tmp/kunst.pid)" open "$COVER"
|
||||
|
|
Loading…
Reference in New Issue