LinuxQuestions.org
Visit Jeremy's Blog.
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, 02: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, 02:33 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403
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, 03:31 PM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,862
Blog Entries: 41

Rep: Reputation: 3042Reputation: 3042Reputation: 3042Reputation: 3042Reputation: 3042Reputation: 3042Reputation: 3042Reputation: 3042Reputation: 3042Reputation: 3042Reputation: 3042
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, 12:24 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 18,167

Rep: Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680
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



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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