0

I saw a question recently where a user wanted to ensure that his script is only executed by using source.

My question is: what's the difference between ./test_script.sh and source test_script.sh? I do know that when source is used the script file doesn't need +x permissions. Are there any other differences? And my second question is: in what kinds of situations is each method appropriate?

nagamani
  • 181
  • 7
  • Try having a look at the manpage for the source command, there's a pretty good explanation there. man source – Matt Feb 16 '18 at 03:01
  • @Matt My distro doesn't have a man page for source. And help source is just 5 sentences long and basically just says the FILENAME is executed in the current shell and what the exit status can be. I'd like a more in depth explanation. – nagamani Feb 16 '18 at 03:07

0 Answers0