Results 1 to 3 of 3

Thread: Basic bash help

  1. #1
    Join Date
    Aug 2006
    Beans
    252

    Basic bash help

    Code:
    #!/bin/bash
    
    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
    then
      "/home/ortango/bin/stopnpr.sh"
      mv "/home/ortango/playlists and webcasts/"*`date +%b%d`* "/home/ortango/playlists and webcasts/failed/wyncmorn_"`date +%b%d%l:%M`.mp3
      "/home/ortango/bin/recordnpr.sh"
    fi
    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.

  2. #2
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Basic bash help

    either use $( ... ) or ` ... \`date +%b%d\`* ... `

  3. #3
    Join Date
    Aug 2006
    Beans
    252

    Re: Basic bash help

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •