dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Replacement for declare in dash?
@ 2013-10-16 12:18 Alexander Huemer
  2013-10-16 13:09 ` Guido Berhoerster
  2013-10-16 14:17 ` Chet Ramey
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Huemer @ 2013-10-16 12:18 UTC (permalink / raw)
  To: dash

Hi,

I wrote a shell script on a non-Debian system and assumed, in my 
greenness, that testing it with #!/bin/bash --posix would ensure that 
the script would run under dash too. I was wrong. Of course that is the 
fault of bash and not dash.
Here is a simplified form of the script:

#!/bin/dash
# This works when run with #!/bin/bash --posix

func() {
        cat /proc/1/environ
}

sudo sh -c "$(declare -f func); func"

Can I do anything equivalent with dash?
I did not find anything in the docs, but hope dies last.
Of course I can swap the function out in a seperate script, but I'd like 
to avoid that.
Thanks in advance for all ideas.

Kind regards,
-Alex

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-16 15:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-16 12:18 Replacement for declare in dash? Alexander Huemer
2013-10-16 13:09 ` Guido Berhoerster
2013-10-16 14:17 ` Chet Ramey
2013-10-16 14:41   ` Eric Blake
2013-10-16 15:34   ` Alexander Huemer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).