Skip to main content

Timeline for Linux bash script to ignore '$'

Current License: CC BY-SA 4.0

8 events
when toggle format what by license comment
Mar 25, 2021 at 21:22 comment added Toby Speight @Alex, I didn't expect that it would be a legal name in any common shell - thanks for educating me today!
Mar 25, 2021 at 21:02 comment added Toby Speight @l0b0, I thought that might be impossible with unmodified Bash, but wasn't sufficiently certain I could prove it, given ways to sneak functions in through the environment for example. Of course, if it matters enough to someone, it wouldn't be too hard to modify a shell to accept $ as a function identifier. I still wouldn't recommend it!
Mar 25, 2021 at 21:00 comment added Toby Speight @choroba, yes absolutely. There's no way in shell that I know of that even the function approach would work with flow-control commands. I tried to give useful feedback that could improve other shell scripts, even though this one is doomed (or at least severely limited).
Mar 25, 2021 at 19:16 comment added Alex Angel It looks like you can do alias "$"="" in zsh (tested, I was using the gnome shell at the time of writing)
Mar 25, 2021 at 18:32 comment added l0b0 You can't create a Bash function or alias with the name $.
Mar 25, 2021 at 18:31 comment added choroba This still fails with some of the examples in my reply.
Mar 25, 2021 at 18:08 history edited Toby Speight CC BY-SA 4.0
Avoid eval!
Mar 25, 2021 at 18:01 history answered Toby Speight CC BY-SA 4.0