I am trying to print a particular text using awk if string is empty. It works fine in the below case
noob@noob:~$ echo "" | awk '{if ($0=="") print "not playing"}'
not playing
but when I try to take a similar approach in the below case it didn't work
noob@noob:~$ mpc current | awk '{if ($0=="") print "not playing"}'
noob@noob:~$
I believe the output of mpc current if no song is playing is an empty string.
noob@noob:~$ mpc current
noob@noob:~$ #empty string
So, is my assumption of empty string wrong?
mpc current | awk '{print "X$0X"}'nothing. It's output is same asmpc currentI mentioned above.awkprocesses 'lines'. If there is no output frommpc current, there is no line to process.