You could replace the word-based iteration with a line-based one:
find . -iname "foo*" | while read f
do
# ... loop body
done
More Related Contents:
- create a file with prefix =file1 followed by the random number
- Why to code a script which will check if some package is installed in linux and if not then install it?
- What does set -e mean in a bash script?
- What’s the magic of “-” (a dash) in command-line parameters?
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Is there a “goto” statement in bash?
- How can I generate new variable names on the fly in a shell script?
- Bash while read loop extremely slow compared to cat, why?
- Redirect STDERR / STDOUT of a process AFTER it’s been started, using command line?
- Find multiple files and rename them in Linux
- How can I loop over the output of a shell command?
- Why does /bin/sh behave differently to /bin/bash even if one points to the other?
- How can I kill a process by name instead of PID, on Linux? [duplicate]
- [ :Unexpected operator in shell programming [duplicate]
- Does “argument list too long” restriction apply to shell builtins?
- Given two directory trees, how can I find out which files differ by content? [closed]
- Using the passwd command from within a shell script
- Add a bash script to path
- Command to get time in milliseconds
- Get last dirname/filename in a file path argument in Bash
- Bash script execution with and without shebang in Linux and BSD
- bash command not found when setting a variable
- Exit code of variable assignment to command substitution in Bash
- Linux/Unix command to determine if process is running?
- Syntax with pound and percent sign after shell parameter name [duplicate]
- Get ceiling integer from number in linux (BASH)
- bash, command not found [duplicate]
- How to convert hex to ASCII characters in the Linux shell?
- How to avoid race condition when using a lock-file to avoid two instances of a script running simultaneously?
- Need to remove the count from the output when using “uniq -c” command