Re: truncating files

1997-12-08 Thread Robert D. Hilliard
From the bash manpage: noclobber If set, bash does not overwrite an existing file with the >, >&, and <> redirection operators. This variable may be overridden when creating output files by using the redirection operator

Re: truncating files

1997-12-08 Thread Hamish Moffatt
On Sun, Dec 07, 1997 at 03:05:00PM -0500, Carl Mummert wrote: > cm>rm -f {list of filenames} > cm>touch {list of filenames} > > This doesn't work if you don't have write permission to the > directory. The solution should be able to truncate any file > I have write access to, even if I can't write

Re: truncating files

1997-12-07 Thread hermit
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Robert D. Hilliard) writes: >> 1) I use set -C in bash, so I can't say > foo if foo exists wthout >> first saying set +C. > ">| foo" overrides the noclobber option Don't you mean ">!", not ">|"?? --Bill. -- William R Ward Bay View

Re: truncating files

1997-12-07 Thread hermit
The problem with removing and recreating is that if a program has that file open for appending (e.g. logfiles), the file isn't actually removed from the disk until that program closes its file descriptor. So you end up with 3 problems: 1. The file still exists on disk, but is not linked to in any

Re: truncating files

1997-12-07 Thread Robert D. Hilliard
> 1) I use set -C in bash, so I can't say > foo if foo exists wthout > first saying set +C. ">| foo" overrides the noclobber option Bob -- TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to [EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED] .

Re: truncating files

1997-12-07 Thread Carl Mummert
cm>> cm>> 1) > foo cm>> 2) cp /dev/null foo cm>> cm>> Problems: cm> cm>> 2) cp /dev/null foo won't take multiple filenames as arguments cm> cm>> So the answer is that I do need a script or program to do the job. cm> cm>What about: cm> cm>rm -f {list of filenames} cm>touch {list of filenames} Thi

Re: truncating files

1997-12-07 Thread Rick Macdonald
On Sun, 7 Dec 1997, Carl Mummert wrote: > Summary: > > 1) > foo > 2) cp /dev/null foo > > Problems: > 2) cp /dev/null foo won't take multiple filenames as arguments > So the answer is that I do need a script or program to do the job. What about: rm -f {list of filenames} touch {list of filen

Re: truncating files

1997-12-07 Thread Carl Mummert
Summary: 1) > foo 2) cp /dev/null foo Problems: 1) I use set -C in bash, so I can't say > foo if foo exists wthout first saying set +C. 2) cp /dev/null foo won't take multiple filenames as arguments So teh answer is that I do need a script or program to do the job. Carl [EMAIL PROTECTED] One

Re: truncating files

1997-12-07 Thread William R Ward
-BEGIN PGP SIGNED MESSAGE- Carl Mummert <[EMAIL PROTECTED]> writes: > Is there already a (standard) utility on a linux box to truncate a > file to 0 bytes? [Besides echo -n "" > foo, which is 1) too long for > my lazy fingers and 2) won't take multiple filenames ] > > Since I couldn't fi

Re: truncating files

1997-12-07 Thread William R Ward
-BEGIN PGP SIGNED MESSAGE- Carl Mummert <[EMAIL PROTECTED]> writes: > Is there already a (standard) utility on a linux box to truncate a > file to 0 bytes? [Besides echo -n "" > foo, which is 1) too long for > my lazy fingers and 2) won't take multiple filenames ] > > Since I couldn't fi

Re: truncating files

1997-12-07 Thread Krzysztof Adamski
A very simple way is ">foo" (noquotes) works in bash. It also creates a file. Krzysztof On Sat, 6 Dec 1997, Carl Mummert wrote: > Is there already a (standard) utility on a linux box to truncate a > file to 0 bytes? [Besides echo -n "" > foo, which is 1) too long for > my lazy fingers and 2) w

RE: truncating files

1997-12-06 Thread Ralph Winslow
Try this one: >foo or, for multiple file names: for xxx in * do >$xxx done where * is any regular expression or: for xxx in a b c d e f g.c h.o g.txt ... do >$xxx done If your finger are lazier than that, I'm afraid I can't help ;-) On 06-Dec-97 Carl Mummert wrote: >Is there already a (stan

Re: truncating files

1997-12-06 Thread Miquel van Smoorenburg
In article <[EMAIL PROTECTED]>, Carl Mummert <[EMAIL PROTECTED]> wrote: >Is there already a (standard) utility on a linux box to truncate a >file to 0 bytes? [Besides echo -n "" > foo, which is 1) too long for >my lazy fingers and 2) won't take multiple filenames ] Yeah, just use > filen