LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 12-13-2007, 03:42 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Can you start a job without getting the job number spit back out?


if I do some sort of "command&", the command gets run in the background, but a job number is spit back to stdout, like:

[1] 3746

... and then when it completes, it sends more to stdout like:

[1] + Done

Is there a way to suppress that output?

Why? In a script, I run several imagemagick commands at once (as many as the user asks for) & would prefer that the user didn't have to see the job numbers and pids flying across their screen. Kinda hard to weed out the other useful info that the script displays.
 
Old 12-13-2007, 05:54 PM   #2
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Rep: Reputation: 39
This might work for you:-
just run it inside brackets (command &)
This will not show PID's but your user will still see normal output, if you want to get output into a file then
(command &) >> file
if you want error output and standard output in a file then
(command &) 2>&1 file
if you want error output in one file and standard output in another then:
(command & > file) >& file2

Hope that helps
 
Old 12-13-2007, 06:00 PM   #3
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by helptonewbie View Post
This might work for you:-
just run it inside brackets (command &)
This will not show PID's but your user will still see normal output...
That worked perfect. Thanks!
 
Old 12-13-2007, 08:54 PM   #4
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Rep: Reputation: 188Reputation: 188
Or...

Code:
command & >> /dev/null
 
Old 12-13-2007, 09:08 PM   #5
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by custangro View Post
Or...

Code:
command & >> /dev/null
That doesn't work for me.

ls& >> /dev/null

in tcsh it doesn't work at all. In bash, it still displays the job number & pid.

:shrug:
 
Old 12-13-2007, 09:09 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
Quote:
Originally Posted by custangro View Post
Or...

Code:
command & >> /dev/null
That doesn't work on bash 3.2.15(2)-release under Slackware 11 - the job info is still output to the terminal here.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Job: Start it Only once on specified time jCash Linux - Newbie 2 12-07-2007 08:35 PM
Pause a Job - bring back as nohup? rizhun Linux - General 3 07-20-2006 09:45 AM
Capture at job number upon submission AmyBVT Programming 4 03-10-2006 01:31 AM
Alrighty, I'm back. Again. Cron Job ... sdebiasio Linux - Newbie 9 08-05-2004 09:02 AM
Can I get a konsole to start from a crontab job? davee Linux - Newbie 2 03-05-2004 06:22 AM


All times are GMT -5. The time now is 10:58 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration