Hi y’all, I often write ed scripts that act on file name, say to search the file name in some registry, like Interslavic dictionary <https://codeberg.org/aartaka/aed/src/branch/main/isv.ed> or Scheme procedure reference <https://codeberg.org/aartaka/schemedoc.ed>. As part of that use, I frequently abuse reading from shell command to get the current file name. Something like:
H !# Get the current file name r !echo % p Q However, searching for "*" with such scripts is broken: $ cat schemedoc.ed | ed -s "*" *: No such file or directory Cannot open input file echo * README.md aed aed_code_coloring aed_markup_coloring assets build calced code_coloring.ed inputrc isv.ed makefile markup_coloring.ed overview.ed schemedoc xed So, instead of searching for literal asterisk, it instead gets a list of all files in the directory. So it doesn’t escape shell globs. I think this is a bug, and, whenever file name is inserted with %, it should be properly escaped. Otherwise the behavior is inconsistent between initial call (cat schemedoc.ed | ed -s "*") and the inner call (echo %) What do you think? Best of luck, -- Artyom Bologov https://aartaka.me
