Search code examples
bashshellsh

source command not found in sh shell


I have a script that uses sh shell. I get an error in the line that uses the source command. It seems source is not included in my sh shell.

If I explicitly try to run source from shell I get:

sh: 1: source: not found

Should I somehow install "source"? Do I have a wrong version of sh?


Solution

  • /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.