LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-07-2008, 03:03 PM   #1
matthhew0101
LQ Newbie
 
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
what does this mean?


I am Oracle DBA, I am trying to learn unix korn shell. I can use/know most of the commnand in unix so I can get around the OS; however, I would like to learn more about korn shell.

1. does anyone know the good book that I can use to start?
2. time to time, I saw this command in a lot of shell scripts but not sure what exactly it's doing

for example:
@ls -l $PASSWORD_FILE > /dev/null 2 >&1

basically, I understand it's doing a list for the password file then write to /dev/null, but what is 2 > &1 mean?

thx
 
Old 11-07-2008, 03:33 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Quote:
1. does anyone know the good book that I can use to start?
That depends a bit on the KSH dialect you are using, but 'Learning the Korn Shell' (Bill Rosenblatt - O'Reilly) should get you going. It is based on ksh88, but I never had any trouble with pdksh (most unix distro's carry this one).

I also have the 'Hands-On KornShell93 Programmnig' book (Barry Rosenberg - Addison Wesley). Great book, nice examples and all is clearly explained. The downside is that ksh93 isn't the same as ksh88/pdksh........

Quote:
basically, I understand it's doing a list for the password file then write to /dev/null, but what is 2 > &1 mean?
2 > &1 -> all that is written to file descriptor 2 (stderr) is redirected to file descriptor 1 (stdout).

.... > /dev/null could also be written as .... 1> /dev/null
Both forms are correct although the second example is (hopefully) easier to understand.

So this .... > /dev/null 2 >&1 will redirect both stdout (the > or 1>) and stderr (2>) to /dev/null, by means of redirecting stderr to file descriptor 1 (the &1 part).

Hope this clears things up a bit.
 
Old 11-07-2008, 04:31 PM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,541
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Welcome to LQ!

I would suggest that you provide a title that is a bit more descriptive to your question. I would suggest that you view the next two Links;
 
Old 11-10-2008, 01:24 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
All the ksh info you could ever want:

http://kornshell.com/

 
  


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




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