source command not found in sh shell source command not found in sh shell bash bash

source command not found in sh shell


/bin/sh is usually some other shell trying to mimic The Shell. Many distributions use /bin/bash for sh, it supports source. On Ubuntu, though, /bin/dash is used which does not support source. Most shells use . instead of source. If you cannot edit the script, try to change the shell which runs it.


In Bourne shell(sh), use the . command to source a file

. filename

In certain OS's/environments (Mac OS, Travis-CI, Ubuntu, at least) this must be:

. ./filename

(Credit to Adrien Joly's comment below)


$ls -l `which sh`/bin/sh -> dash$sudo dpkg-reconfigure dash #Select "no" when you're asked[...]$ls -l `which sh`/bin/sh -> bash

Then it will be OK