Bash shell 脚本将变量传递到花括号上
我正在拔头发,
#!/bin/sh
queryNumber=10
if [ "$1" == "start" ]; then
systemctl start myProcess@{1..$queryNumber}
elif [ "$1" == "stop" ]; then
systemctl stop myProcess@*
fi
有谁知道为什么我无法将 $queryNumber
参数传递到 shell 脚本中
I am pulling my hair out,
#!/bin/sh
queryNumber=10
if [ "$1" == "start" ]; then
systemctl start myProcess@{1..$queryNumber}
elif [ "$1" == "stop" ]; then
systemctl stop myProcess@*
fi
Does anybody knows why I am not being able to pass the $queryNumber
parameter onto the shell script
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是由于 queryNumber 被定义为环境变量
或者尝试在 Bash Shell 而不是 sh 中运行该程序
This may be due to queryNumber is defined as Environment Variable
or try running the program in Bash Shell rather than sh