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*

9
  • I just ran: bash -c 'echo txt files are "$@"' meaningful-arg0-for-error *.txt on Ubuntu 14.04, bash version 4.3.11(1)-release, and I got: txt files are *.txt. O.o Commented Aug 27, 2014 at 10:51
  • 3
    @muru, which is correct (and you probably don't have txt files in the current directory). See also bash -c 'echo "${1?}"' foo Commented Aug 27, 2014 at 10:59
  • Ah, yes. That's an practically useful example. Commented Aug 27, 2014 at 11:19
  • 2
    sh -c 'shift "$2"; echo txt files are "$@"' tentative-arg0 3 2 *.txt is fantastically inventive! Commented Aug 27, 2014 at 13:02
  • 1
    @poige, check in info bash 'expansion, parameter'. In the man page on Ubuntu, I find Omitting the colon results in a test only for a parameter that is unset Commented May 22, 2020 at 12:41