Skip to main content
5 events
when toggle format what by license comment
Mar 14, 2014 at 6:06 comment added mikeserv It's true it was debated. There were some weird semantic arguments on what is run and what is executed and whatever. I think what it came down to was some said a script is not run if it doesn't happen in its own process. In my opinion: echo this is run $(echo and this is run). I thought - and still do - that it was dangerous to suggest a sourced script is not run, because, again, echo 'echo this is run' >~/script.sh ; . ~/script.sh and ( . ~/script.sh ) are both run. In fact, a . run script affects your current environment and so is more risky to run.
Mar 14, 2014 at 4:22 comment added slm The above comment was debated for over an hour in the chatroom. Several examples were presented that demonstrated to all but mikeserv that the answer that I've characterized above is exactly what's going on.
Mar 14, 2014 at 1:54 comment added mikeserv POSIX's . DOES run the other script in the current shell environment. As far as I know, source is just a bashism for . without the safety mechanism of requiring a qualified path, though I could be wrong. As I understand it, the only real difference between the two is source script.sh works whereas . script.sh doesn't unless you . ./script.sh. In any case, the script and any functions or programs it calls, are run.
Sep 7, 2013 at 21:13 history edited slm CC BY-SA 3.0
edited body
Sep 5, 2013 at 10:37 history answered slm CC BY-SA 3.0