LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-09-2008, 08:58 PM   #1
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 282

Rep: Reputation: 30
Problem understanding line in script


So i have a script I got off the internet that I'm using for ideas and there is one line i don't understand:
Code:
/bin/passwd -n $PASSMIN -w $PASSWARN $USERNAME >/dev/null 2>&1
I understand most of it but the last part where it adds it to NULL or something, what is that about?
 
Old 02-09-2008, 09:42 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
>/dev/null sends standard output to the trash and 2>&1 sends error output to standard output. /dev/null goes nowhere; it's where you redirect things you wish to ignore. Diverting standard error to standard output allows you to pipe it to another program, or the author could want all output from the script to go to the same place.
ta0kira
 
Old 02-09-2008, 09:42 PM   #3
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
>/dev/null sends standard output to the trash and 2>&1 sends error output to standard output. /dev/null goes nowhere; it's where you redirect things you wish to ignore. Diverting standard error to standard output allows you to pipe it to another program, or the author could want all output from the script to go to the same place.
ta0kira
 
Old 02-09-2008, 09:58 PM   #4
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 282

Original Poster
Rep: Reputation: 30
Ok, I think I got it. Thanks.
 
  


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
Help understanding a script Gins Programming 11 04-12-2007 02:13 AM
iptables: not understanding a specific line. xpucto Linux - Security 5 03-21-2006 03:14 PM
Need help understanding script....? jmr0311 Mandriva 3 08-08-2004 07:42 AM
Startup script, help understanding it..? jmr0311 Linux - Software 1 08-07-2004 05:59 PM
burning cdrs using cdrecord (ver2.0) from the command line (understanding) hamster Linux - General 2 05-13-2003 06:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:48 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