Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Adding text to the beginning of a file
- Date: Sat, 17 Mar 2007 21:06:40 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] Adding text to the beginning of a file
- References: <45FA6B45.3040500@example.com> <ba75897e0703160413oc5219d7gb2bea3d53cd0afc2@example.com> <45FB452B.8050205@example.com> <ba75897e0703162026gb5fec8cm94470f4e30b117c4@example.com>
Arwyn Hainsworth writes: > Note that the for loop will iterate over a list of words delimited by > spaces, so if you have spaces in your file names the above won't work. > I use an ugly hack to get it to work, but I suspect someone else knows > a much more elegant way of doing it, so I'm not going to post the > hack. I don't know any way offhand to get file names with spaces to work under for. I tried setting IFS to newline and using `ls` instead of *, but that seems to confuse bash completely in trying to parse the for statement. If you have an explicit list of file names, then just surround the weird ones with ''. If you are going to compute the list from a file listing and execute the command on each in sequence, then find ... -exec is probably the way to go. If you need to execute on all the file names in one command, find ... -print0 | xargs -0 ... is probably the way to go. Why spaces are permitted in file names I don't know, when to the user NO-BREAK SPACE is visually identical. The UI could be exactly the same.
- Follow-Ups:
- Re: [tlug] Adding text to the beginning of a file
- From: Edward Wright
- Re: [tlug] Adding text to the beginning of a file
- From: Godwin Stewart
- References:
- [tlug] Adding text to the beginning of a file
- From: Dave M G
- Re: [tlug] Adding text to the beginning of a file
- From: Arwyn Hainsworth
- Re: [tlug] Adding text to the beginning of a file
- From: Dave M G
- Re: [tlug] Adding text to the beginning of a file
- From: Arwyn Hainsworth
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Adding text to the beginning of a file
- Next by Date: [tlug] get free local port for script?
- Previous by thread: Re: [tlug] Adding text to the beginning of a file
- Next by thread: Re: [tlug] Adding text to the beginning of a file
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links