A sysadmins guide to Bash
Re: A sysadmins guide to Bash
I really disagree with his line "for file in $(ls)". Of course this should be "for file in *".
-
- Posts: 11176
- Joined: Sun Jan 14, 2018 5:38 pm
Re: A sysadmins guide to Bash
You might want to contact him and let him know.
- dai_trying
- Posts: 634
- Joined: Sun Jan 14, 2018 7:44 pm
- Location: UK
- Contact:
Re: A sysadmins guide to Bash
I think that example was used just to illustrate why you shouldn't use back-ticks rather than saying it is the best command to use for a file list, personally I tend to use python when I want to get those sort of results and sometimes I even source a python script to get the filenames (and paths if required) and parse it back into the bash script but I find it a bit tedious so usually just use python for the whole thing.