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*

6
  • 1
    Since it looks like you're intending to output the command and its arguments as a single string, it would make more sense to use $*. Commented Aug 2, 2022 at 11:48
  • @terdon, would you like to show me the case in which the quoting will be necessary here? Commented Aug 2, 2022 at 13:08
  • 1
    @MainFurr sure, run it as foo.sh "*" for example. It should print foo.sh * but if you leave it unquoted, it will print foo.sh and then everything in the current directory. Commented Aug 2, 2022 at 13:10
  • @terdon seems like bash behaves differently from csh, and I didn't pay attention to interpreting when called the bash with test script as argument from csh. Ok, thanks. Commented Aug 2, 2022 at 13:29
  • Thanks @MainFurr! In this specific case, $0 will print ../cc.sh, while $@ print the rest of the arguments that come after, is that true? Commented Aug 2, 2022 at 23:53