windows - 修改shell脚本以在windows中执行
问题描述
我需要使这个脚本适应我的环境:
for entry in `ls *.tcl`
do
if [ -f "$entry" ];then
echo "$entry"
echo test.bat -w test_workspace -file ./$entry
test.bat -w test_workspace -file ./$entry
fi;
done
我把这个脚本和 test.bat 放在同一个地方,但我有这个错误:
test.bat -w test_workspace -file ./script1.tcl
bash: test.bat: command not found
解决方案
你可以调用cmd命令来执行 bat 文件,如下所示:
for entry in `ls *.tcl`
do
if [ -f "$entry" ];then
echo "$entry"
echo test.bat -w test_workspace -file ./$entry
cmd /c test.bat -w test_workspace -file ./$entry
fi;
done
推荐阅读
- javalite - activeweb ContentFor 标签什么都不渲染?
- python - 在我的 Ubuntu18 中,我错误地从 /usr/lib 中删除了 python 文件夹?如果我运行命令“sudo apt-get install --reinstall python”然后不工作
- user-interface - 为什么剪辑被认为“开罗太慢”?
- c# - 从代码中获取控制台记录的消息
- python - 如何在python中从今天开始更改日期?
- audio - 从 Rust 中的多个音频流中并行获取相同大小的块
- drools - OptaPlanner:我试图打印出 ConstraintMatch 的 justificationList,但得到了不是我的域类的 SubnetworkTuple 对象
- php - PHP SELECT 语句中的比较与多行数组作为比较变量
- javascript - Angular中带有密码模式的正则表达式问题
- python - Shapely 多边形与 Matplotlib 楔形的交集