meaning of &1


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting meaning of &1
# 1  
Old 03-04-2011
meaning of &1

All,
In the below mentioned line ---
Code:
$SCRIPT_FILES/wrapper_sleep.ksh > $MVXREFLOG 2>&1

what is the meaning of &1 here.


Regards
Oracle User

Last edited by Franklin52; 03-04-2011 at 03:05 AM.. Reason: Please use code tags
# 2  
Old 03-04-2011
0,1,2 are the file descriptor for STDIN, STDOUT and STDERR respectively.

0 -- STDIN - standard input , is by default keyboard.
1 -- STDOUT - standard output, is by default terminal
2 -- STDERR - standard error, is by default terminal

In your command, STDOUT is set to a file ( with redirection, 1 is optional here ) and STDERR is set to STDOUT ( wherever the STDOUT is set)

"&" is the syntax for that. So 2>&1 means standard error is being redirected to standard output which is finally set to a file. so both stdout and stderr will go to file.

just to make sure, its not $1
# 3  
Old 03-04-2011
thanks anchal.
Ohh yes! I typed it by misake.

Regards
Oracle User

Moderator's Comments:
Mod Comment Changed subject from "... $1" to "... &1"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies

2. UNIX for Beginners Questions & Answers

&& meaning in UNIX

Hi Team, I know that "&" holds the result of current pattern match. But what does "&&" means and its use please? Thanks & Regards, Batta Archana (6 Replies)
Discussion started by: Archana Batta
6 Replies

3. Shell Programming and Scripting

Replace & sign to &amp word

Hi, I have text file abc.txt. In this file, I have the following data. Input: Mr Smith &amp Mrs Smith Mr Smith &apos Mrs Smith Mr Smith & Mrs Smith Mr Smith& Mrs Smith Mr Smith &Mrs Smith Output: Mr Smith &amp Mrs Smith Mr Smith &apos Mrs Smith Mr Smith &amp Mrs Smith Mr Smith&amp... (4 Replies)
Discussion started by: naveed
4 Replies

4. Shell Programming and Scripting

replace & with & xml file

Hello All I have a xml file with many sets of records like this <mytag>mydata</mytag> <tag2>data&</tag2> also same file can be like this <mytag>mydata</mytag> <tag2>data&</tag2> <tag3>data2&amp;data3</tag3> Now i can grep & and replace with &amp; for whole file but it will replace all... (4 Replies)
Discussion started by: lokaish23
4 Replies

5. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

6. Shell Programming and Scripting

What is the meaning of $_

Hi, Can somebody tell the usage of "$_" cd $_ ? and ls $_ ? (4 Replies)
Discussion started by: giri_luck
4 Replies

7. Shell Programming and Scripting

Meaning of >&2

What does >&2 at the end of the statement echo "Alright man..." >&2 mean? (4 Replies)
Discussion started by: proactiveaditya
4 Replies

8. Shell Programming and Scripting

meaning of & in sh shell

All, I have a line in my code like below , could any one please tell me what this actually mean what is the & doding there. I am in sh shell #!/bin/sh .............. mv &fname &III.tar.gz Thanks in Advance, Arun (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

9. Shell Programming and Scripting

Meaning of "> /dev/null 2>&1"

Hi, I am new into UNIX shell scripting and I am wondering what is the meaning of the below text which appears at the end of each line in the ".sh" file: > /dev/null 2>&1 For example, the line below: sh $HOME/stats/Rep777/Act_777.sh omc omc > /dev/null 2>&1 I know for sure what "sh... (10 Replies)
Discussion started by: salanalani
10 Replies

10. UNIX for Dummies Questions & Answers

meaning of .& in shell

Hi , can anyone explain me the meaning of following line ". &13FNAME/version_encours/cfg/dfm.cfg" Regards (1 Reply)
Discussion started by: scorpio
1 Replies
Login or Register to Ask a Question