If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > strange problem : grep ^- in cron is not working

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-25-03, 13:29
Manikandan Manikandan is offline
Registered User
 
Join Date: Aug 2002
Location: India
Posts: 60
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
Reply With Quote
  #2 (permalink)  
Old 03-27-03, 05:15
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,543
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



Quote:
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 05:18.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On