View Full Version : Basic bash help

November 8th, 2007, 09:17 PM

npr1=du -k "/home/ortango/playlists and webcasts/"*`date +%b%d`* | cut -f 1
sleep 20
npr2=du -k "/home/ortango/playlists and webcasts/"*`date +%b%d`* | cut -f 1
if $npr1 = $npr2
mv "/home/ortango/playlists and webcasts/"*`date +%b%d`* "/home/ortango/playlists and webcasts/failed/wyncmorn_"`date +%b%d%l:%M`.mp3

thats what i have, but my npr1 assignments are not working.
i tried npr1=${.....}
but that didn't work for me either and i trie `backticks` around the statement

the code is for restarting a mplayer streamdump that had lost its connection (mplayer keeps running in this case, so checking the pid doesnt work). cron will run this script every few minutes while the recordnpr.sh is schedueled.

November 8th, 2007, 11:03 PM
either use $( ... ) or ` ... \`date +%b%d\`* ... `

November 9th, 2007, 05:03 AM
used the first one.

i gotta say bash syntax is tough, its not like c.

im still havein problems with my if statements(oh the regression), but i'm pretty sure i've got it down now. thanks for the hand