Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rarely needed #3

Open
Stefan-Wagner opened this issue Jun 13, 2022 · 0 comments
Open

rarely needed #3

Stefan-Wagner opened this issue Jun 13, 2022 · 0 comments

Comments

@Stefan-Wagner
Copy link

The canonical way of doing this without map in bash is not:

for f in $(ls *.c)
do
  foo $f
  bar $f
done

but

for f in *.c
do
  foo "$f"
  bar "$f"
done

because it handles whitespace in file names gracefully.
(Mantra: Don't parse the output of ls).
And most GNU-coreutils programs handle multiple input files themselves like

file X*
wc -m *.log 
head *.conf 
# ... many more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant