how to get stderr


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to get stderr
# 8  
Old 06-16-2011
Mac people run screaming into the night when you show them byte streams and shells!

The Bourne shell (sh), named for it's creator at AT&T Bell Labs Stephen R. Bourne - Wikipedia, the free encyclopedia, was the precursor to the ksh (Korn shell, named for it's creator at AT&T Bell Labs http://en.wikipedia.org/wiki/David_K...uter_scientist) ) and bash (born again shell, written by Fox for GNU http://en.wikipedia.org/wiki/Bash_(Unix_shell)), and being simpler might be infinitesimally faster. However, the ksh and bash provide a much richer Character User Interface, for more capabilities and allowing simpler, shorter, more intuitive scripts and command sequences. The csh, written by Bill Joy at U C Berkeley C shell - Wikipedia, the free encyclopedia, is a sort of side offshoot, much less sh compatible, highly flavored to the C language, and a bit more advanced than the Bourne shell, but most find the ksh or bash more desirable. The bash does a bit more than even the latest ksh93, and is fairly compatible. The ksh and other shells have flavored offshoots, like dtksh and tcsh, with extended capabilities for certain contexts. Some command line and ksh features depend on open fd's being mapped into the file system, usually like for instance on Solaris, /dev/fd/0 and /dev/stdin.

Last edited by DGPickett; 06-16-2011 at 11:33 AM..
# 9  
Old 06-16-2011
Quote:
Originally Posted by giova
SmilieThank you So much Corona !
Now it works, i'm totally confused with that QuoteDoubleQuoteBackQuoteUnderQuote syntax, but this now just works like a charms Smilie
It's actually two syntaxes. $() is the modern version of backticks, added because backticks are awkward for nesting:

Code:
# nesting backticks
echo `echo \`echo asdf\``
# nesting $()
echo $(echo $(echo asdf) )

The double quotes just do what double quotes always do, preventing a string from being split apart. I quote everything habitually, but if you know for sure the output will never contain any whitespace, you can leave the double quotes off.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Doubt regarding stderr

Hi All, I am writing a shell script code. and i want the stderr to be send to a file and the stdout to be displayed in terminal. In my shell script code i use a read command to get data from user.read -r -p "Enter the type :" data and while i execute my script i use./my_script.sh 2>... (4 Replies)
Discussion started by: Vinoth R
4 Replies

2. Solaris

can't get stderr port

Hi Experts, i have a solaris 9 OS and i get the following message repeated many time in my /var/adm/messages : Oct 31 16:30:44 baobab rsh: can't get stderr port: Cannot assign requested address have you any idea how can i resolve this issue ??:confused: thanks for help (2 Replies)
Discussion started by: lid-j-one
2 Replies

3. Shell Programming and Scripting

How to redirect stderr to a file as well

Hello everyone, I'm a nooby in Linux, and I need some help. I have a shell script like this: echo "Start of script" > ../My_Log_Dir/Script_Name.log .. cp ../My_DataIn/File.txt ../My_DataOut/ 2>> ../My_Log_Dir/Script_Name.log rc=$? .. echo "End of Script" >>... (5 Replies)
Discussion started by: H.Faria
5 Replies

4. Shell Programming and Scripting

stderr/stdout

Can somebody explain to me why the diff output is not going to stderr? Yet when I issue a diff from the command line the return code is -ne 1. I am guessing diff always writes to stdout??? Is there away I can force the difff to write to stderr USING THE CURRENT template. If possible, I... (5 Replies)
Discussion started by: BeefStu
5 Replies

5. Shell Programming and Scripting

Append stderr

Hi everybody. I was used to redirect stderr to a file in this way, calling a generic script:./myScript &> output.logBut now I need something more sophisticated...Inside a bash script I launch an executable in this way:${command} >> "${globalLogFile}"So I redirect the stdout into globalLogFile.... (14 Replies)
Discussion started by: canduc17
14 Replies

6. Shell Programming and Scripting

Redirecting stderr problem

% ls -ld /usr /foo ls: /foo: No such file or directory drwxr-xr-x 14 root wheel 512 May 18 02:49 /usr % ls -ld /usr /foo 1>/dev/null/ /dev/null/: Not a directory. % ls -ld /usr /foo 2>/dev/null/ /dev/null/: Not a directory. ^^Why why why doesn't this work for me. Furthermore, where is... (7 Replies)
Discussion started by: phpfreak
7 Replies

7. BSD

Awstats stderr solution

Hello! Firts of all, sorry fo my poor english, but i hope you'll undestand me :) Ok, let's go to the problem.... I have a lot of awstats crontabs, and i have one mail,where i get daily and weekly output of all servers that i administrate, now it's problem that i get to his mail every time,... (3 Replies)
Discussion started by: flashm3
3 Replies

8. Shell Programming and Scripting

STDERR output

Hi, Need some help here on a script I'm writing. I know that STDERR is normally done is this manner: script 2>stderr.out However, if I wanted to output the stderr from a rsh command how do I do that? Example: su - username -c "rsh $hostname /opt/gilberteu/scriptname" 1>stdout... (5 Replies)
Discussion started by: gilberteu
5 Replies

9. UNIX for Dummies Questions & Answers

stderr redirection

Does anyone know away of redirecting the stderr for a bourne or korn shell script to a file. (5 Replies)
Discussion started by: blakmk
5 Replies

10. Programming

stderr

in fprint(stderr, "lkjalsdi\n"); what does stderr mean? thanks (1 Reply)
Discussion started by: dell9
1 Replies
Login or Register to Ask a Question