Re: Whitespace in filenames
- From: Centurion <spam.this@xxxxxxxxxxx>
- Date: Tue, 28 Feb 2006 10:57:29 +1100
soup_or_power@xxxxxxxxx wrote:
I have inherited some code that looks like this:
if [ ! -f $file ]
then
echo "Error Can't clean >$file<. May have spaces in the
name?"
else
mv "$file" DEL.$file
fi
I have these questions:
a) can it be rewritten as if [ ! -f "$file" ]...
b) change the mv as mv "$file" "DEL.$file"
Yes...until you hit a file with a double-quote in the file name :P But
that's a whole other world of pain. Your proposed solution will work on
files with spaces and most other non-printable/unicode/etc text elements.
Cheers,
James
--
You'll be sorry...
.
- References:
- Whitespace in filenames
- From: soup_or_power
- Whitespace in filenames
- Prev by Date: Re: Is Linux BSD or System V ?
- Next by Date: Re: HELP -- UBUNTU -- Do not have a proper compiling system
- Previous by thread: Re: Whitespace in filenames
- Next by thread: Using grep
- Index(es):
Relevant Pages
|