Purpose of 2>&1 in the command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Purpose of 2>&1 in the command
# 1  
Old 05-27-2008
Purpose of 2>&1 in the command

Can any body kindly tell me what is the purpose of 2>&1 in the following commands.

nohup ./append_import.sh 1 > import1.out 2>&1 < /dev/null &
nohup ./append_import.sh 2 > import2.out 2>&1 < /dev/null &
# 2  
Old 05-27-2008
Redirect Standard error to CURRENT standard output(which could be file or /dev/null) ..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If && command giving wrong output

Hi All, I am trying to run a script which will search for 2 strings(stopped,started) in a text file and echo an output depending on below condition -bash-3.2$ cat trial1.txt v ggg f -bash-3.2$ cat trial1.sh VAR9=` grep 'stopped' /tmp/trial1.txt` VAR10=` grep 'started'... (4 Replies)
Discussion started by: srkmish
4 Replies

2. Shell Programming and Scripting

Read input while another command is running &&

This script runs tshark, then displays the output. I want to read a keypress at all times throughout this script, especially during the 10 seconds that tshark is running. This code however, only takes input before tshark runs. #!/bin/bash main() { while (( "1" == "1" )) ; do keypress &&... (3 Replies)
Discussion started by: Kiah07
3 Replies

3. Shell Programming and Scripting

[Solved] BASH - chaining TEST and COMMAND with && and II

Can you explain what this line of script is doing. What I have understood is : -- variable C is the name of a software which is either not installed, so it must be installed or allready installed and then should be update if newer version found -- branch B="$B $C" is to install the software --... (4 Replies)
Discussion started by: jcdole
4 Replies

4. UNIX for Dummies Questions & Answers

Purpose of - (hypen) in script or command line

Hi, I am new for unix and I am following ABS guide. What is the purpose of - (hypen ) in the below command and What it will do in this?. Can anyone explain it in detail. Rest of the things in the below command I understood somewhat. (cd /source/directory && tar cf - . ) | (cd /dest/directory &&... (1 Reply)
Discussion started by: gwgreen1
1 Replies

5. Solaris

ifconfig primary & standby purpose

I have two ethernet interfaces nge0 and nge1. An IP assigned on nge0 is 10.10.10.1/24 and on nge1 is 20.20.20.1/24. I want to make nge0 as primary interface. My question here is, 1. Being nge0 as primary interface, if I ping to an IP 20.20.20.5, what will happen? 2. If the answer for the... (4 Replies)
Discussion started by: nthiruvenkatam
4 Replies

6. UNIX for Dummies Questions & Answers

What is the purpose of 2 >&1 in crontab?

while we editing the cron at the end of the cron what is the purpose of giving 2 >&1 (4 Replies)
Discussion started by: senmak
4 Replies

7. Solaris

Purpose D option in useradd command

Hi Can any one tell about -D option in the useradd command? Thanks MaroV (3 Replies)
Discussion started by: vr_mari
3 Replies

8. UNIX for Dummies Questions & Answers

Problem with xterm & tcsh & sourcing a script in a single command

Hi friends, I have a script that sets the env variable path based on different conditions. Now the new path variable setting should not done in the same terminal or same shell. Only a new terminal or new shell should have the new path env variable set. I am able to do this only as follows: >cd... (1 Reply)
Discussion started by: sowmya005
1 Replies

9. UNIX for Dummies Questions & Answers

sleep 10 && command doesn't work

Hi there, I found a trick to easily postpone a command by a few seconds: supernova:~# sleep 10 && command &If you logout, the command should still be executed... But not all the time. Could anyone of you explain me why the following command is executed even after logging out: supernova:~# sleep... (2 Replies)
Discussion started by: chebarbudo
2 Replies

10. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies
Login or Register to Ask a Question