为什么不是最近命名的可执行文件被创建?但是如果我删除了shift
,它确实创建了该文件?没有创建可执行文件
if [ "$1" = "-o" ];
then
op="$2"
shift 2
gcc -o "$op" "[email protected]" &> errors.txt
else
shift
echo "went to else -o not detected"
gcc "[email protected]" &> errors.txt
fi
如果你在你的代码之前添加'set -x'行,bash会在运行之前打印出变量展开的确切行。 – indiv
您是否将'-o'传递给脚本? –
该脚本的当前输入是./compile -o executable_filename file1 file2 file3 .... op应该是executable_filename – jobravooo