Re: :? within a function
Greg Wooledge <[email protected]> Mon, 18 May 2026 09:19:18 -0400
| Newsgroups | gmane.comp.shells.bash.bugs,gmane.comp.shells.bash.help |
|---|---|
| Message-ID | <[email protected]> |
On Mon, May 18, 2026 at 19:34:03 +0700, Robert Elz wrote: > I did not see that, probably it was only sent to help-bash, to which I > do not subscribe (I don't know bash well enough to help people who have > issues with it, but I do know shells in general well enough to know what > is a bug, and what isn't, at least when it doesn't involve bash extensions). > > However, I would consider that to be a simple bug which should be fixed > in the source, not the man page (and a little surprising, as for many > things, sourced files act like functions - no args, etc, but "return" > works.) FYI in bash, "." and "source" do take args. hobbit:~$ cat bin/args #!/bin/sh printf "%d args:" "$#" test "$#" -gt 0 && printf " <%s>" "$@" echo hobbit:~$ cat foo args "$@" hobbit:~$ dash -c '. ./foo x y z' 0 args: hobbit:~$ bash -c '. ./foo x y z' 3 args: <x> <y> <z>