Wildcard on redirection

Ralf Mardorf ralf.mardorf at rocketmail.com
Sat Aug 5 12:13:14 UTC 2017


On Sat, 5 Aug 2017 13:58:50 +0200, Jos Chrispijn wrote:
>I have this number of .log files which I would like to empty.
>
>Using
>
>echo > *.log
>
>unfortunately doesn't work so I created
>
>foreach file in (/myfiles/log/*log)
>   echo "" > $file
>end
>
>but that sequence is not recognized at all.
>
>Can you tell me how to solve? Thanks!

I suspect the dot isn't useful at all, I guess with or without the dot
"analog" would be "*log", too, but actually your shell might treat the
dot in a different way.

However

echo "" | tee *log

does the trick.

https://www.freebsd.org/cgi/man.cgi?query=tee&sektion=1&apropos=0&manpath=redhat





More information about the freebsd-questions mailing list