Home » Infrastructure » Unix » strange problem : grep ^- in cron is not working
strange problem : grep ^- in cron is not working [message #97860] Tue, 25 March 2003 11:30 Go to next message
mani
Messages: 105
Registered: September 1999
Senior Member
Hi,
I have crontab which initiates the shell called call.sh.

My call.sh is :

var=`ls -ltr &#124grep ^-&#124tr -s " "&#124cut -d " " -f9&#124grep ^INP&#124sort`
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~
Re: strange problem : grep ^- in cron is not working [message #97861 is a reply to message #97860] Wed, 26 March 2003 02:42 Go to previous messageGo to next message
Frank Naude
Messages: 4580
Registered: April 1998
Senior Member
Hi,

Try the following:

1) Cron might use a different shell. Spesify the shell you want to use on top of your script. I.e. #!/bin/ksh

2) Put ^IMP and ^- in single quotes

Best regards.

Frank
Re: strange problem : grep ^- in cron is not working [message #97865 is a reply to message #97861] Fri, 28 March 2003 06:16 Go to previous messageGo to next message
Victoria
Messages: 152
Registered: July 2002
Senior Member
Hi Frank,
Thanks a lot.It exactly what we did in our code.
Thanks
~V~
Re: strange problem : grep ^- in cron is not working [message #97877 is a reply to message #97860] Thu, 03 April 2003 15:33 Go to previous message
Anand
Messages: 161
Registered: August 1999
Senior Member
Hi,

What are you trying to achieve through that 'grep' command? Are you filtering out '-' characters and "INP" characters? If so, try 'grep -v'.

Your code would be like this:

`ls -ltr &#124grep -v '-'&#124tr -s " "&#124cut -d " " -f9&#124grep -v 'INP'&#124sort`
Previous Topic: SOLUTION PLEAse
Next Topic: Getting output parameter of proc inside shell script
Goto Forum:
  


Current Time: Tue May 21 14:52:52 CDT 2024