I'm trying to source (bash-parlance) a file in dash using . file
as specified by the man page:
. file The commands in the specified file are read and executed by the shell.
But I get an error even though the file is there:
$ ls
defaults.sh run.sh
$ cat run.sh
#!/bin/sh
. defaults.sh
echo "VAR: $VAR"
$ cat defaults.sh
VAR=abc
$ bash run.sh
VAR: abc
$ dash run.sh
run.sh: 3: .: defaults.sh: not found
The same thing happens when I try . defaults.sh
in an interactive dash.
Where am I going wrong here?
PATH
tosource
a file is not a very good idea I think but might be a last resort if you have a script you cannot change. – pLumo Apr 27 '22 at 08:25