LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Thread Tools
Old 10-16-2003, 12:21 PM   #1
XFox
LQ Newbie
 
Registered: Oct 2003
Location: Italy
Distribution: Mac OS X 10.2.8
Posts: 3
Thanked: 0
Question Ambiguous output redirect


[Log in to get rid of this advertisement]
Hi,
I have this line in my crontab file:

*/10 * * * * cd /usr/local/setiathome-3.03.powerpc-apple-darwin1.2; ./setiathome -nice 19 1>/dev/null 2>/dev/null

When cron checks the crontab and launches the setiathome process all goes well, but if I cd to the setiathome folder and try to manually launch the process with the same command, that is:

./setiathome -nice 19 1>/dev/null 2>/dev/null

I get an error message from the shell that says:

Ambiguous output redirect.

and the process isn't launched.

Why?
I use the tcsh shell on Mac OS X 10.2.8.
TIA.
XFox is offline     Reply With Quote
Old 10-16-2003, 01:20 PM   #2
slightcrazed
Member
 
Registered: May 2003
Location: Lisbon Falls, Maine
Distribution: RH 8.0, 9.0, FC2 - 4, Slack 9.0 - 10.2, Knoppix 3.4 - 4.0, LFS,
Posts: 789
Thanked: 0
I *think* this is because tcsh does not recognize bash style redirects (1>/dev/null). Can you launch the app without the redirects?

I don't use tcsh, so I don't know the proper syntax for the redirect that you are doing.

man tcsh might help out with this.

slight
slightcrazed is offline     Reply With Quote


Old 10-17-2003, 12:00 PM   #3
XFox
LQ Newbie
 
Registered: Oct 2003
Location: Italy
Distribution: Mac OS X 10.2.8
Posts: 3
Thanked: 0

Original Poster
Quote:
Originally posted by slightcrazed
I *think* this is because tcsh does not recognize bash style redirects (1>/dev/null). Can you launch the app without the redirects?
Yes, naturally.

Quote:
Originally posted by slightcrazed
I don't use tcsh, so I don't know the proper syntax for the redirect that you are doing.

man tcsh might help out with this.
Probably you're right, I searched in man tcsh and there is written that to redirect standard and diagnostic output the right sintax is:

>& \dev\null

But I'm still wondering why the same line in the crontab file works, and if I launch it from the shell it doesn't work.
Perhaps cron uses another shell?
If so, how can I know what shell it uses?
XFox is offline     Reply With Quote


Old 10-17-2003, 12:11 PM   #4
slightcrazed
Member
 
Registered: May 2003
Location: Lisbon Falls, Maine
Distribution: RH 8.0, 9.0, FC2 - 4, Slack 9.0 - 10.2, Knoppix 3.4 - 4.0, LFS,
Posts: 789
Thanked: 0
Possible. I'll do some reading on cron and see if that is the case. Honestly, I don't use cron that often, so I never paid attention to which shell it uses.

slight
slightcrazed is offline     Reply With Quote


Old 10-17-2003, 12:27 PM   #5
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,124
Thanked: 1
my crontab says
Shell=/bin/bash
at the beginning
most scripts are set to use sh or bash.
whansard is offline     Reply With Quote


Old 10-17-2003, 08:29 PM   #6
XFox
LQ Newbie
 
Registered: Oct 2003
Location: Italy
Distribution: Mac OS X 10.2.8
Posts: 3
Thanked: 0

Original Poster
Thumbs up Resolved!

In my crontab file I haven't specified any shell.
Searching with Google I found this:
http://www.gsp.com/cgi-bin/man.cgi?s...&topic=crontab
It says "Several environment variables are set up automatically by the cron(8) daemon. SHELL is set to /bin/sh, […]".
To prove this I have placed this line in my crontab:
*/1 * * * * echo $SHELL > ~/usedShell.txt
Then I looked at the file originated and is says exactly "/bin/sh"!
Thanks a lot for all the answers!
XFox is offline     Reply With Quote



Reply

Bookmarks


Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash returns ambiguous redirect with date in filename rstoutmna Programming 4 01-12-2005 05:50 AM
how to redirect the output of a terminal? cpukiller Linux - Networking 5 11-10-2004 08:07 AM
redirect untar output mnauta Linux - General 3 05-01-2004 08:21 PM
Ambiguous Redirect Error AMMullan Linux - General 1 10-01-2003 09:39 PM
ambiguous redirect? cuss Linux - General 4 03-06-2003 11:58 AM


All times are GMT -5. The time now is 08:13 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration