-----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 find one, I wrote a little C program to do it, but I > am still interested in whether there is already one on the system.
Other users have suggested the use of "> foo", a "null command", but that does not work in tcsh, my preferred shell. Note that "echo > z" does not, as you might expect it to, add a blank line (at least under tcsh). So you can save 5 characters from your example that way. However the way I do this is by doing "cp /dev/null foo"... I don't remember why but this is supposedly a better way of doing it. I think it preserves the file permissions more accurately? I am not sure. I picked that up years ago but have since forgotten the reason... HTH. - --Bill. - -- William R Ward Bay View Consulting http://www.bayview.com/~hermit/ [EMAIL PROTECTED] 1803 Mission St. #339 voicemail +1 408/479-4072 [EMAIL PROTECTED] Santa Cruz CA 95060 USA pager +1 408/458-8862 -----BEGIN PGP SIGNATURE----- Version: 2.6.2 Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface iQCVAwUBNIo/lR25V7Ur0zHlAQHVUQP/cX0J9D6OFRmON4k4CM8Ah8lmePipA7O6 6nlSc3ibyfbQHAsf3mxhVNOPx/QhBxFafEwFE905OLx5PJQpePIkF12BviQcjP86 /Z4l0VGHIM1fj0Vka6huMx9ShhVLZZHeNMcQq4SM2kDYHX3oWD0LScr3zZadFTMe MN0hsbhtLXo= =S+BB -----END PGP SIGNATURE----- -- TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to [EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED] . -- TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to [EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED] .