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*

8
  • 3
    This only works if the values don't contain any shell special character. You can make this robust, but it requires some effort. Commented Feb 29, 2016 at 23:29
  • Well now I'm interested! How can you make this robust --- why isn't this robust? Commented Feb 29, 2016 at 23:31
  • Are you saying, I need to escape all shell special chars before eval? Commented Feb 29, 2016 at 23:38
  • 1
    As soon as you're executing source against a foreign script, you're in very dangerous territory. Escaping the actual values matters little if the script has a rm -rf $HOME. Updating answer to reflect this. Commented Feb 29, 2016 at 23:45
  • You're obviously right - tbh I didn't even think of rm -rf $HOME :) So eval cat script in subshell ?!? :) Commented Feb 29, 2016 at 23:51