Afficher un message
Vieux 21/08/2006, 02h20   #2
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to escape special chars in filenames

On 2006-08-21, Jerry Fleming wrote:
> I have a list (about 600) of files whose names contain special
> characters, such as spaces, &, (. Under bash, they have to be escaped. I
> was wondering if there is any command, or even a piece of sed, which can
> be used to escape them.


How are you using the names?

The usual method is to quote the file name:

for file in ./*
do
cat "$file"
done

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
  Réponse avec citation
 
Page generated in 0,05926 seconds with 9 queries