Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    Please edit your question and show an example of you using your gc function. I'm 99% sure the issue is that you are running something like gc Fixed $var. If you are, the expansion of $var (and !) to potentially nothing happens before your func is executed. Commented Sep 13, 2023 at 13:29
  • 1
    I don't think you can get it any shorter than gc 'I just fixed $var, yay!' without messing with shell expansion options. Commented Sep 13, 2023 at 13:30
  • @Panki Edited. Yeah I want to force single quotes if possible, that would work too. Commented Sep 13, 2023 at 13:39
  • Similar: Any shell where expansions are turned off without escaping or quoting? Commented Sep 13, 2023 at 18:00
  • See also How to write a function that takes an argument string that does not need to be quoted? Commented Sep 13, 2023 at 18:00