Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Location
    India
    Posts
    60

    Unanswered: strange problem : grep ^- in cron is not working

    Hi,
    I have crontab which initiates the shell called call.sh.
    My call.sh is :

    var=`ls -ltr |grep ^-|tr -s " "|cut -d " " -f9|grep ^INP|sort`
    echo $var

    here when i run a crontab am getting the error
    call.sh . INP not found.

    I think the usage of grep ^ is having some problem while using in crontab.

    can ne 1 pls help me..
    Thanks in advance
    ~V~
    Thanks & Regards
    Manikandan

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: strange problem : grep ^- in cron is not working

    A sort at the end of the command defeats the purpose of the 'tr' options in 'ls -ltr' ...

    I do not know why yurs does not work in cron , but you can do the same using te below script:

    ls -p | sed '/\//d'

    sort is not required as ls produces an alphabetically sorted list.

    Hope this helps

    Cheers

    Sathyaram



    Originally posted by Manikandan
    Hi,
    I have crontab which initiates the shell called call.sh.
    My call.sh is :

    var=`ls -ltr |grep ^-|tr -s " "|cut -d " " -f9|grep ^INP|sort`
    echo $var

    here when i run a crontab am getting the error
    call.sh . INP not found.

    I think the usage of grep ^ is having some problem while using in crontab.

    can ne 1 pls help me..
    Thanks in advance
    ~V~
    Last edited by sathyaram_s; 03-27-03 at 06:18.

Posting Permissions

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