As described here Is there a difference between “.” and “source” in bash, after all?, I'm trying to set-up this approach in a simple script without success so far (Raspian Jessie). When using the following code:

cat /media/usb0/tmp/NT20.sh
echo $var1

as expected it lists the content of the file. However when using this code:

source /media/usb0/tmp/NT20.sh


. /media/usb0/tmp/NT20.sh

I get this error returned: "source not found". There must be something quite obvious that I don't understand. Or is the source command not support by this flavor of bash on Jessie Lite?

NT20.sh file is:


This idea behind this is to be able to store a persistent variable and read it when needed. Thank you for help.

  • This is not a Pi question. source will include the contents of a file in a script and execute it - not list it. The error presumably comes from a failed execute of some code. – Milliways Apr 3 '18 at 12:05
  • Well I made another test. What is not reported here is that the exit command terminates NT20.sh which causes the entire script to end prematurely. AND source command is not supported only the notation with a dot . In other words with so few lines I had two bugs ;) So it is fine know I have a way to manage persistent data with batch – N Rabaté Apr 3 '18 at 12:06
  • I'm voting to close this question as off-topic because the problem cannot be reproduced. – Dmitry Grigoryev Apr 5 '18 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.