A sysadmins guide to Bash

Discussion of programming related topics
Post Reply
crosscourt
Posts: 11176
Joined: Sun Jan 14, 2018 5:38 pm

A sysadmins guide to Bash

Post by crosscourt »

chris
Posts: 125
Joined: Mon Jan 15, 2018 11:37 pm
Location: UK

Re: A sysadmins guide to Bash

Post by chris »

I really disagree with his line "for file in $(ls)". Of course this should be "for file in *".
crosscourt
Posts: 11176
Joined: Sun Jan 14, 2018 5:38 pm

Re: A sysadmins guide to Bash

Post by crosscourt »

You might want to contact him and let him know.
User avatar
dai_trying
Posts: 634
Joined: Sun Jan 14, 2018 7:44 pm
Location: UK
Contact:

Re: A sysadmins guide to Bash

Post by dai_trying »

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.
Post Reply