bash_notes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
bash_notes [2022/04/06 22:38] – [list file names within a specific range] raju | bash_notes [2023/12/28 08:46] – [useful links] 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]] |
- | < | + | |
- | $ echo file{18..21}.txt | + | |
- | file18.txt file19.txt file20.txt file21.txt | + | |
- | </ | + | |
- | The sequence expression takes the form '' | + | ===== dummy ===== |
+ | ==== other pages in this wiki ==== | ||
+ | * [[bash scripting]] | ||
- | Ref: | + | ==== useful links ==== |
- | * https://www.gnu.org/software/ | + | * https:// |
- | * https://superuser.com/questions/236484/ | + | * https://mywiki.wooledge.org/ArithmeticExpression |
+ | * https://misc.flogisoft.com/bash/tip_colors_and_formatting | ||
+ | * http:// | ||
- | Possible use cases: | + | ==== documentation links ==== |
+ | * ignoredups, erasedups - https:// | ||
- | * To list files < | + | ==== what is the difference between "ls > dirlist 2>& |
- | ls file{18..21}.txt | + | The command |
+ | < | ||
+ | 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