How do you run a job without output going to screen?

This is a discussion on How do you run a job without output going to screen? within the Linux Programming forums, part of the Platform Specific Boards category; Hello there; Let's say I have a simple script called 'program' that prints variable X, then the script does x=x+1, ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    13

    How do you run a job without output going to screen?

    Hello there;

    Let's say I have a simple script called 'program' that prints variable X, then the script does x=x+1, and then repeats.

    How would I start this job in the background, but don't let the output show up on screen?

    To start a job in the background, I know I would enter $ program& in Bash, and my hunch is that I would redirect the standard output to a file instead of the monitor.

    I tried $ program& > fileoutput, but that still prints to screen.

    Any ideas?

    Thanks!!!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    program > file
    Runs the program, redirecting stdout to file

    program > file 2>errs
    Runs the program, redirecting stdout to file and errors to err

    program > file &
    Runs the program, redirecting stdout to file, and puts the program in the background to allow you to do other things.

    That's just a taste of things which are possible.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jun 2007
    Posts
    13
    Thank you Mr. Salem!!

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    If you want the output to simply vanish instead of going into a file, use /dev/null as the destination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Render text
    By Livijn in forum C++ Programming
    Replies: 6
    Last Post: 07-06-2007, 03:32 PM
  2. screen output question
    By f6ff in forum C++ Programming
    Replies: 2
    Last Post: 06-08-2006, 08:43 PM
  3. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 03:56 PM
  4. I can't find a job.
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 42
    Last Post: 06-29-2003, 08:35 PM
  5. Weird string output only for first run
    By Evilelmo in forum C++ Programming
    Replies: 4
    Last Post: 03-04-2003, 08:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21