admin 管理员组文章数量: 1087652
bash运行.sh文件出现 command not found: XX某变量名
bash运行.sh文件出现 command not found: XX某变量名
bash或zsh运行 temp.sh
temp.sh
#!/bin/bash
export CUDA_VISIBLE_DEVICES=1
# compile pse
cd ./pse/
python setup.py build
cd ..
## run test
test_img_dir = "path/to/img/test" # 【注意这里test_img_dir后面的空格】
test_single_img_path='/path/to/test/xx.jpg'
result_base="./results/"
net_file = "network_v3"
net_arch="resnet18"python -u ./test.py \--test_single_img_path "${test_single_img_path}" \--test_img_dir "${test_img_dir}" \--result_base "${result_base}" \--net_file ${net_file} \--net_arch ${net_arch} \
出现错误
- test.sh: line 19: /data00/shiwei.11/datasets/detData1/stamp/crop_images/test: Is a directory
- test.sh:20: command not found: test_img_dir
- test.sh:28: command not found: net_file
解决措施
其实这个问题很简单,在写xx.sh文件时,定义每个变量时,后面的“=”与变量名之间不要留空格,与后边的值之间也不要有空格,上边代码中删除test_img_dir和net_file后面的空格就好。
在window上写文件时,容易造成空格错误,没有高亮提醒。
本文标签: bash运行sh文件出现 command not found XX某变量名
版权声明:本文标题:bash运行.sh文件出现 command not found: XX某变量名 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1686637668a20308.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论