BashScripts.org
http://bashscripts.org/forum/

Question|Whats /dev/null?
http://bashscripts.org/forum/viewtopic.php?f=16&t=596
Page 1 of 1

Author:  de_man [ Tue Nov 11, 2008 4:42 am ]
Post subject:  Question|Whats /dev/null?

whats /dev/null ?

or,what does this do/mean:

chmod +x run_game

./run_game > /dev/null 2>&1 &

Author:  jeo [ Tue Nov 11, 2008 5:01 pm ]
Post subject: 

/dev/null is the center of the universe!

This Wikipedia article should help:
http://en.wikipedia.org/wiki/Data_sink

It's basically a black hole. It's where you send stuff that you don't ever want to see again. You can redirect output there, and it doesn't get written to disk or anything, it's just gone, into the ether!

-J

Author:  fredrik.eriksson [ Mon Nov 17, 2008 9:11 am ]
Post subject: 

Yepp, /dev/null is the neverending garbage can :P

"chmod +x run_game" this means make run_game executable, if you didn't you'd have to run it like "bash run_game" (substitute bash with your shell :P)

./run_game > /dev/null 2>&1 &
This means to execute run_game, redirect stdout (standard out) to /dev/null, then bond together stderr (standard error output) and stdout.
The & at the end just says this program should run in the background.

There's an easier way then doing it like that thou. This will do the same thing. I'm not even sure if redirecting and then bonding works.
Anyway, this tells the shell to redirect both stderr (standard error, the "2") and stdout (standard out, the "1") to /dev/null
./run_game 2>&1 /dev/null &

Best regards
Fredrik Eriksson

Page 1 of 1 All times are UTC - 6 hours
© 2000, 2002, 2005, 2007 phpBB Group • http://www.phpbb.com