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*

3
  • you can run your script using env command before, like this: env -i <SCRIPT.sh> Commented Mar 5, 2015 at 12:58
  • Only if env isn't redefined as a function as well. This is terrifying. I first thought that special characters would help -- calling with full path that includes /, using . to source, and so on. But those can also be used for function names! You can redefine any function you want, but it's hard to get back to calling the original command. Commented Mar 5, 2015 at 13:03
  • 1
    True, but if you're going to run any script on a compromised machine you're screwed anyway. Alternatively, write your script in #/bin/sh if this is not default interactive shell. Commented Mar 5, 2015 at 13:07