Re: calling script function on output of find
- From: dave.gma+news002@xxxxxxxxxxxxxxxxxxxxxx (Dave Gibson)
- Date: Sat, 09 Jul 2011 19:52:54 +0100
John Stumbles <john.stumbles@xxxxxxxxxxxx> wrote:
On Tue, 05 Jul 2011 19:17:29 +0100, Dave Gibson wrote:
find "$SOURCE_DIR" -type f -size +0 | while IFS= read -r f ; do
process_file "$f"
done
One question: why the -r switch ("Backslash does not act as an escape
character") to read?
To ensure that a backslash has the same meaning in read's input as it
does in find's output.
In an empty directory:
$ touch 'foo\bar'
$ find . -name 'foo*'
./foo\bar
$ find . -name 'foo*' | { read f ; printf '%s\n' "$f" ; }
./foobar
$ find . -name 'foo*' | { read -r f ; printf '%s\n' "$f" ; }
./foo\bar
.
- References:
- calling script function on output of find
- From: John Stumbles
- Re: calling script function on output of find
- From: Dave Gibson
- Re: calling script function on output of find
- From: John Stumbles
- calling script function on output of find
- Prev by Date: Re: Slow down a Process
- Next by Date: Re: Good Linux to start with
- Previous by thread: Re: calling script function on output of find
- Next by thread: Re: calling script function on output of find
- Index(es):
Relevant Pages
|