Skip to main content

Thread: script to check for empty last line and delete it


i have cool conky from
http://www.quicktweaks.com/2008/09/2...buntu-desktop/

lately i've not been getting temps show up. i've figured out because weather file generates has empty last line , script reads last line temp. want check empty last line , if there delete (hence making temp last line again).
code isn't working, doing wrong:

code:
#!/bin/bash  plik=~/weather2          w3m -dump http://weather.yahoo.com/forecast/"$kod".html | grep -a21 "current" | sed 's/deg/°/g' > $plik   if [ "`tail -1c "$plik"`" == " " ];                                           sed '$d' $plik >> $plik;          fi

quote posted inphektion view post
i have cool conky from
http://www.quicktweaks.com/2008/09/2...buntu-desktop/

lately i've not been getting temps show up. i've figured out because weather file generates has empty last line , script reads last line temp. want check empty last line , if there delete (hence making temp last line again).
code isn't working, doing wrong:

code:
#!/bin/bash  plik=~/weather2          w3m -dump http://weather.yahoo.com/forecast/"$kod".html | grep -a21 "current" | sed 's/deg/°/g' > $plik   if [ "`tail -1c "$plik"`" == " " ];                                           sed '$d' $plik >> $plik;          fi
i change
code:
if [ "`tail -1c "$plik"`" == " " ]
to
code:
if [ "`tail -1c "$plik"`" == "" ]


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] script to check for empty last line and delete it


Ubuntu

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'