I am having a problem with a script and hope someone here can help.
I have a Ruby script that includes an “open” method call to create a
subprocess and return a string. Shown here is a much simplified
version where I can recreate the problem.
$f = File.open("/tmp/foo.log", “a”)
#cmdline = "|ls -l"
cmdline = "|/opt/localname/bar …"
s = open(cmdline)
s.each do |line|
$f.print line
done
When this script is executed from the command line shell the "open"
method succeeds for the /opt/localname/bar program.
However, when the script is executed from within a shell script the
method fails.
Instead of printing the expected results the message “Daemon not
connected” is printed.
The “ls -l” command works in either situation.
I have reviewed the environment variables and there does not seem to
be anything relevant there. Any thoughts? Pointing out a stupid
mistake would be great!