"Robin H. Johnson" writes: > 1. > If your AWK command has an error, then this clobbers the file, a > better variant, with die, would be: > awk "$@" "$f" >"${tmpf}" || die "awk failed..." > cp -f "${tmpf}" "$f" || die "copy back failed" Thanks! On the one hand it's a simple function, and on the other hand there are several things which can go wrong. I will submit corrected version with unit test. Why '-f' is required? >> # @USAGE: > This calling format is also a problem if they intended to pass multiple > files to the command, or if they do so accidentally. > > Eg, an unprotected glob in the first argument, eg: > eawk foo* '/foobar/{$1="x"; print $0}' > > If foo1 and foo2 existed, this would be considered as: > awk foo2 /foobar/{$1="x"; print $0}' foo1 > > which really will NOT have the desired effect. I am aware of this. I considered before: a) eawk files... -- awk_args... b) eawk awk_args -- pattern files... making '--' required, but that just complicates usage and function itself. And anyway isn't it true for any other command with careless glob use? I have documented that function takes a file, not files. The effect of misuse eawk would be awk error. Although maybe it would be useful to support multiple files? Then I'd go for variant (b) probably. Cheers, -- Amadeusz Żołnowski