< "$@" doesn't expand properly?

Marc Chantreux <[email protected]> Sat, 4 Oct 2025 00:47:01 +0200
Newsgroups org.kernel.vger.dash
Message-ID <aOBSZYeG7UDIbOE6@prometheus>
hello everyone,

I wrote a simple "inplace" script to be able to
work with commands that have no -i options.

The simplest way to do it (I thought) was

#!/bin/sh
set -eux
< "$@" | sponge "$1"

so inplace counter awk '{$0+=2}1' would be expanded
as

< 'counter' 'awk' '{$0+=2}1' | sponge 'counter'


but there is an error message

./inplace: 3: cannot open counter awk {$0+=2}1: No such file

so it seems that the expansion leads to

< 'counter awk {$0+=2}1' | sponge 'counter'

is this an expected behavior?

regards

-- 
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQQrhynLytp14smlCwy+er2aYc+1WAUCaOBSYQAKCRC+er2aYc+1
WIUxAP91RIOI8W67hbrLQvkoZ9BspPHcDed6sIEoAX5gu9UHOgEAsueKem8Fazn7
+p98CzMZNQTsAHn5GGwHBjf9t4AUzQk=
=4Niw
-----END PGP SIGNATURE-----