Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

我的脚本想自动获取 nginx.conf 位置。

如:运行脚本返回:

/usr/local/nginx/conf/nginx.conf

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
349 views
Welcome To Ask or Share your Answers For Others

1 Answer

通过nginx -t获得

nginx=`nginx -t 2>&1 | grep configuration`
if [ ! -z "$nginx"  ];then
    nginxtmp="${nginx#*file}"
    nginxf="${nginxtmp%test*}"
    echo $nginxf
fi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...