我的脚本编写经验很少。我已经尝试了一个新脚本来循环遍历多个子目录,并在子目录存在时编辑文件。以下是我多次尝试后失败的代码,但我无法解决for循环错误:
!#/usr/din/sh
for domain in {PGBWAHS_NA PGBWAHS04_NA PGBWAHD_NA PGBWAHD04_NA PGBWAHQ_NA PGBWAHQ02_NA PGBWAHQ03_NA PGBWAHQ04_NA PGBWAHP_NA PGBWAHP02_NA PGBWAHP03_NA PGBWAHP04_NA
do
echo "$domain this is the current domain from the array"
cd /opt/tibco/tra/domain/$domain
echo `pwd` "this is the directory after cd command"
cp hawkagent.cfg hawkagent.cfg.back
sed 's/-scan_rate 10/-scan_rate 30/' hawkagent.cfg
Done
____________________
Error message returned:
$ ./modify_log_scan_rate.sh
./modify_log_scan_rate.sh[3]: Syntax error at line 3 : `for' is not matched.
答案 0 :(得分:0)
在* {* PGBWAHS_NA ...
中的域中后删除开口花括号答案 1 :(得分:0)
Done
需要done
(案例事项)。
- Etan Reisner