LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux 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
  Search this Thread
Old 10-16-2003, 11:21 AM   #1
XFox
LQ Newbie
 
Registered: Oct 2003
Location: Italy
Distribution: Mac OS X 10.2.8
Posts: 3

Rep: Reputation: 0
Question Ambiguous output redirect


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.
 
Old 10-16-2003, 12: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

Rep: Reputation: 30
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
 
Old 10-17-2003, 11:00 AM   #3
XFox
LQ Newbie
 
Registered: Oct 2003
Location: Italy
Distribution: Mac OS X 10.2.8
Posts: 3

Original Poster
Rep: Reputation: 0
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?
 
Old 10-17-2003, 11:11 AM   #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

Rep: Reputation: 30
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
 
Old 10-17-2003, 11:27 AM   #5
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
my crontab says
Shell=/bin/bash
at the beginning
most scripts are set to use sh or bash.
 
Old 10-17-2003, 07:29 PM   #6
XFox
LQ Newbie
 
Registered: Oct 2003
Location: Italy
Distribution: Mac OS X 10.2.8
Posts: 3

Original Poster
Rep: Reputation: 0
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!
 
  


Reply



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 5 09-13-2011 07:37 PM
how to redirect the output of a terminal? cpukiller Linux - Networking 5 11-10-2004 07:07 AM
redirect untar output mnauta Linux - General 3 05-01-2004 07:21 PM
Ambiguous Redirect Error AMMullan Linux - General 1 10-01-2003 08:39 PM
ambiguous redirect? cuss Linux - General 4 03-06-2003 10:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:00 AM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration