Bash script for files with spaces in the filenames
Dotan Cohen
dotancohen at gmail.com
Fri Feb 17 23:58:11 UTC 2006
On 2/18/06, Eric Brunson <brunson at brunson.com> wrote:
> Here are a few comments on your buddy's script:
>
> * in bash PWD is maintained by the shell, so you don't need to set
> it with `pwd`
> * you don't need to call "find $PWD", anyway, you can just do "find
> .", since . *is* $PWD
> * back ticks in shell scripts are so 1989, the preferred method
> since 1994 is this: $( some shell script )
> * "for file in $( something big )" could blow out the max size of
> the command line, which is usually around 4096 characters (I
> think, but I never encounter it, since I code around it)
>
> Try this:
>
> #!/bin/bash
> find | while read file
> do
> eyeD3 --force-update --set-encoding=utf8 "$file"
> done
>
Than you, I will keep those pointers in mind. Although I have by now
gotten past the filenames problem, I will most certainly use your
advice in the future as I will undoubtably need to learn to script in
bash.
Dotan Cohen
http://technology-sleuth.com/question/why_are_internet_greeting_cards_dangerous.html
54
More information about the fedora-list
mailing list