Register
It is currently Tue Sep 30, 2014 5:57 pm

Question|Whats /dev/null?


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Tue Nov 11, 2008 4:42 am   

Joined: Tue Nov 11, 2008 4:35 am
Posts: 1
whats /dev/null ?

or,what does this do/mean:

chmod +x run_game

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


Top
 Profile  
 PostPosted: Tue Nov 11, 2008 5:01 pm   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
/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


Top
 Profile YIM  
 PostPosted: Mon Nov 17, 2008 9:11 am   

Joined: Mon Nov 17, 2008 7:25 am
Posts: 221
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


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP