I have a command which I run via eval
as shown below.
#! /bin/sh
readonly scr="MYENV=1 sh /tmp/scr.sh"
eval ${scr} -a 1 -b 2
Now I want to run the scr
script with lockf
utility, so I made the following changes:
#! /bin/sh
readonly scr="MYENV=1 sh /tmp/scr.sh"
lockf -k /tmp/f.lock eval ${scr} -a 1 -b 2
This throws the following error:
lockf: eval: No such file or directory
Basically the limitation is the MYENV=1
which needs to be exported while running the command (thus the use of eval
).
I'm a beginner in shell programming and am unsure on how to get around this. How do I make this work?