I have a script, which when I run to screen, works perfectly. The directory structure is as follows:
/home/username/processing/ScriptRunning
/home/username/processing/functions/include_me
In the script, it opens another script, which contains a function by simply doing this:
#!/bin/bash
#This is ScriptRunning script
. functions/include_me
Now when I call the script using the following nohup command:
nohup /home/username/processing/ScriptRunning
this is the output:
/home/username/processing/ScriptRunning: line 3: /home/username/functions/include_me: No such file or directory
It seems to be missing out the processing
directory
I've altered the line within the ScriptRunning
to have a full path, both hardcoded to /home/username/processing
and also having this as a variable created by calling $(pwd)
, but the error is the same.
Am I really missing something so stupid?
This isn't a
nohup
issue. You are including a source file using a relative file name. Try:to include a source file located relative to
${BASH_SOURCE}