【发布时间】:2013-01-09 21:12:18
【问题描述】:
我有一个脚本文件(“测试”,没有文件名),其中包含:
cd /userdata/waf/Template
iaprod -python myscript.py>Outputlog
echo "hello"
当我进入命令窗口时,我输入以下内容并得到这个输出:
-bash-3.00$ chmod 775 testing
-bash-3.00$ ./testing
: No such file or directorydata/acct/waf/Template
<<Starting on sim1>>
hello
所以由于某种原因,第一行中的更改目录命令不起作用。但是,最后两行中的 python 脚本和 echo 工作正常。唯一的问题是我需要在正确的目录中运行 python 脚本。
任何想法为什么 cd 不能解决所有问题?如果我直接将代码逐字输入命令行,一切正常。
【问题讨论】:
-
您在什么操作系统上以及如何执行脚本?如果是 Makefile,除非您使用括号对命令进行分组,否则该目录将不会保留。
标签: python unix batch-file directory