All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Huemer <alexander.huemer@xx.vu>
To: dash@vger.kernel.org
Subject: Replacement for declare in dash?
Date: Wed, 16 Oct 2013 14:18:59 +0200	[thread overview]
Message-ID: <20131016121859.GA30169@yade.xx.vu> (raw)

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

             reply	other threads:[~2013-10-16 12:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16 12:18 Alexander Huemer [this message]
2013-10-16 13:09 ` Replacement for declare in dash? Guido Berhoerster
2013-10-16 14:17 ` Chet Ramey
2013-10-16 14:41   ` Eric Blake
2013-10-16 15:34   ` Alexander Huemer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131016121859.GA30169@yade.xx.vu \
    --to=alexander.huemer@xx.vu \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.