当我构建 shell 脚本时出现以下错误,因为我是 CentOS 新手,无法找出原因,任何人都可以帮助我解决这个问题吗?
我想我们需要在执行时传递命令行参数,但不确定这里必须传递什么参数。
Shell 脚本:
#!/bin/sh
# Default place to look for apr source. Can be overridden with
# --with-apr=[directory]
apr_src_dir=../apr
while test $# -gt 0
do
# Normalize
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case "$1" in
--with-apr=*)
apr_src_dir=$optarg
;;
esac
shift
done
if test -d "$apr_src_dir"
then
echo ""
echo "Looking for apr source in $apr_src_dir"
else
echo ""
echo "Problem finding apr source in $apr_src_dir."
echo …Run Code Online (Sandbox Code Playgroud)