[NTLUG:Discuss] How do I make all files in a directory of zero length?
Fred James
fredjame at concentric.net
Wed Jun 6 12:43:20 CDT 2001
How do you define "pretty"?
Lance Simmons wrote:
>
> On Wed, Jun 06, 2001 at 11:49:13AM -0500, George E. Lass wrote:
> >
> > #!/bin/bash
> > for FILE in *
> > do
> > if [ -f $FILE -a $FILE != cmd ]
> > then
> > > $FILE
> > fi
> > done
> >
> >
> > Then do: chmod 777 cmd
> > ./cmd
>
> for FILE in *; do > $FILE
>
> also works.
>
> I couldn't get the other suggestion
>
> cat /dev/null > *
>
> to work; bash complains about an ambiguous redirect.
>
> I'm happy to go with the "for ... in *; do > $..." construction,
> but I wonder if there's not a prettier way.
>
> Thanks to everyone who replied.
> --
> .~.
> /v\ Lance Simmons
> // \\ lance at lsimmons.net
> /( )\
> __^_^________________________________________________________________________
> Technology is the knack of so arranging the world that we do not experience it.
> -- Max Frisch
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
--
...small is beautiful...
More information about the Discuss
mailing list