Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Disable most shell expansion to function or script



See
https://unix.stackexchange.com/questions/714338/any-shell-where-expansions-are-turned-off-without-escaping-or-quoting

https://unix.stackexchange.com/questions/716836/zsh-alias-or-shell-function-to-only-echo-its-command-line-including-shell-cont

https://unix.stackexchange.com/questions/731845/how-to-write-a-function-that-takes-an-argument-string-that-does-not-need-to-be-q

For some possible avenues.


On 4 January 2024 18:09:57 GMT, "Sam B." <me@xxxxxx> wrote:
Hello,

I'm looking for a way to disable most shell expansion for the arguments to a script or function and treat everything up to a newline char as verbatim text, i.e. as if quoted.

For example, given a function/script "todo", I'd like

todo Text inc. $var, *glob?, events!, <redirs, >(sub) & more

to behave more like it was quoted:

todo 'Text inc. $var, *glob?, events!, <redirs, >(sub) & more'

I know of noglob to disable glob chars, and can have a look at histchars to see if events can be disabled. But I'm not sure if any of the other expansion can possibly disabled.

Mostly I'm interested joting down some plain text which could include '?!&' and have "todo" receive it all without the shell having done some magic beforehand.

Any ideas?


Messages sorted by: Reverse Date, Date, Thread, Author