bash_notes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
bash_notes [2022/04/06 22:36] – [list file names within a specific range] raju | bash_notes [2023/12/28 08:49] (current) – [other pages in this wiki] raju | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== tasks ===== | ===== tasks ===== | ||
- | ==== list file names within a specific range ==== | + | ==== dummy ==== |
- | In bash, we can use a '' | + | * [[list files within a specific range]] |
- | < | + | ===== dummy ===== |
- | $ echo file{18..21}.txt | + | ==== other pages in this wiki ==== |
- | file18.txt file19.txt file20.txt file21.txt | + | * [[bash scripting]] |
- | </ | + | * [[shell scripting notes]] |
- | The sequence expression takes the form '' | + | ==== useful links ==== |
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * http:// | ||
- | Ref: | + | ==== documentation links ==== |
- | * https:// | + | * ignoredups, erasedups - https:// |
- | * https:// | + | |
- | Possible usages: | + | ==== what is the difference between "ls > dirlist 2>& |
- | + | The command | |
- | To list files | + | |
< | < | ||
- | ls file{18..21}.txt | + | ls > dirlist 2>&1 |
</ | </ | ||
- | + | directs both standard output (file descriptor 1) and standard error (file descriptor 2) to the file dirlist, while the command | |
- | Use a for loop to run a command | + | |
< | < | ||
- | for file in file{18..21}.txt | + | ls 2>&1 > dirlist |
- | ... | + | |
</ | </ | ||
+ | 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. | ||
- | tags | list file names with a range | + | To conclude, the order of redirections is significant. |
+ | |||
+ | Ref:- https:// | ||
- | ===== dummy ===== | ||
- | ==== useful links ==== | ||
- | * https:// | ||
===== getopts ===== | ===== getopts ===== | ||
==== useful articles ==== | ==== useful articles ==== |
bash_notes.txt · Last modified: 2023/12/28 08:49 by raju