[英]using `at' to execute bash script
I made a bash script that invoke jvm to execute a jar prog. 我制作了一个bash脚本,该脚本调用jvm来执行jar编。 The script works well.
该脚本运行良好。 I want to use the prog `at' to execute my bash script at some time, but the script only works partly:
我想使用prog`at'来执行我的bash脚本,但是该脚本只能部分起作用:
#!/bin/bash
touch hello.world
while read line
do
touch another.hello.world
name=$line
...
done < "/users/me/readin.txt"
The command I used: 我使用的命令:
$ at -f myscript.bash now
Only hello.world file was generated, but no another.hello.world . 仅生成了hello.world文件,而没有生成another.hello.world 。 So, there must be something wrong in my script or the command usage.
因此,我的脚本或命令用法中肯定有问题。 What should I do?
我该怎么办?
The only probability of another.hello.world
file not being created is iteration of while loop is not happening at least once. 无法创建
another.hello.world
文件的唯一可能性是while循环的迭代至少没有发生一次。
So probably input file /users/me/readin.txt
is blank. 因此,输入文件
/users/me/readin.txt
可能为空。
I suggest you to execute code with set -x
option, you will find the reason. 我建议您使用
set -x
选项执行代码,您会找到原因。 It will display the trace of what is being execute. 它将显示正在执行的跟踪。
#!/bin/bash
touch hello.world
set -x
while read line
do
touch another.hello.world
name=$line
...
done < "/users/me/readin.txt"
set +x
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.