[英]using `at' to execute bash script
我制作了一個bash腳本,該腳本調用jvm來執行jar編。 該腳本運行良好。 我想使用prog`at'來執行我的bash腳本,但是該腳本只能部分起作用:
#!/bin/bash
touch hello.world
while read line
do
touch another.hello.world
name=$line
...
done < "/users/me/readin.txt"
我使用的命令:
$ at -f myscript.bash now
僅生成了hello.world文件,而沒有生成another.hello.world 。 因此,我的腳本或命令用法中肯定有問題。 我該怎么辦?
無法創建another.hello.world
文件的唯一可能性是while循環的迭代至少沒有發生一次。
因此,輸入文件/users/me/readin.txt
可能為空。
我建議您使用set -x
選項執行代碼,您會找到原因。 它將顯示正在執行的跟蹤。
#!/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.