Replacement for declare in dash?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux