User Tools

Site Tools


bash_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
bash_notes [2022/06/06 15:49] – [useful links] rajubash_notes [2022/11/08 20:40] – [what is the difference between "ls > dirlist 2>&1" and "ls 2>&1 > dirlist"?] raju
Line 12: Line 12:
 ==== documentation links ==== ==== documentation links ====
   * ignoredups, erasedups - https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html search for ignoredups .   * ignoredups, erasedups - https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html search for ignoredups .
 +
 +==== what is the difference between "ls > dirlist 2>&1" and "ls 2>&1 > dirlist"? ====
 +The command
 +<code>
 +ls > dirlist 2>&1
 +</code>
 +directs both standard output (file descriptor 1) and standard error (file descriptor 2) to the file dirlist, while the command
 +<code>
 +ls 2>&1 > dirlist
 +</code>
 +directs only the standard output to file dirlist, because the standard error was made a copy of the standard output before the standard output was redirected to dirlist.
 +
 +To conclude, the order of redirections is significant.
 +
 +Ref:- https://www.gnu.org/software/bash/manual/html_node/Redirections.html -> 5th paragraph.
 +
 ===== getopts ===== ===== getopts =====
 ==== useful articles ==== ==== useful articles ====
bash_notes.txt · Last modified: 2023/12/28 08:49 by raju