On 2026-09-05, 09:03, Harry Graf wrote:> IMHO filenames as a c-string in the
shell context should
be escapted.
The following example works on every version of ed, ex and vi in the
last last fifty plus years. This includes macOS ed (which preceded GNU
ed), *BSD ed, OpenSolaris ed, OpenSolaris ex, vim, nex, nvi etc. The
sole exception is Antonio's GNU ed.
$ ed
a
#!/bin/sh
for i in 1 2 3; do
echo $i
done
.
w o.sh
q
$ chmod +x o.sh
$ ./o.sh
1
2
3
$ ed -p '*' "`cat o.sh`"
#!/bin/sh
for i in 1 2 3; do
echo $i
done: No such file or directory
?
*!%
1
2
3
!
*q
$