A sysadmins guide to Bash

Discussion of programming related topics
Post Reply
User avatar
crosscourt
Posts: 11102
Joined: Sun Jan 14, 2018 5:38 pm
Location: Wash DC
Contact:

A sysadmins guide to Bash

Post by crosscourt »

Site Moderator
chris
Posts: 106
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 *".
User avatar
crosscourt
Posts: 11102
Joined: Sun Jan 14, 2018 5:38 pm
Location: Wash DC
Contact:

Re: A sysadmins guide to Bash

Post by crosscourt »

You might want to contact him and let him know.
Site Moderator
User avatar
dai_trying
Posts: 706
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