I have a shell script file (run.sh) that contains the following:
#!/bin/bash %JAVA_HOME%/bin/java -jar umar.jar
when i try to run it (./run.sh), it gives me following: umar/bin/run.sh: line 1: fg: no job control
However if I run same command directly on shell, it works perfectly.
开发者_高级运维What's wrong with the script file?
Thanks
%foo% is not how you do command substitution in a bourne/BASH shell script. I assume you're running this from a Windows command line, which is why it works when you run it directly. Try using proper bourne syntax:
${JAVA_HOME}/bin/java -jar umar.jar
Try turning on monitor mode
set -m
%JAVA_HOME% will substitute a Windows environment variable and is appropriate in a .bat file.
Try the following shell script which should work on most UNIX like systems.
#!/bin/bash
$JAVA_HOME/bin/java -jar umar.jar
精彩评论