下面是shell脚本:
#!/bin/bash
FA_log_locations=`echo $1| sed 's/,/" "/g; s/$/")/g; s/^/("/g'`
echo $FA_log_locations
for jj in FA
do
PASSWORD=$FA_PASSWORD
USER=$FA_USER
eval number_of_dirs=\${#${jj}_log_locations[@]}
for ii in `seq 0 $((number_of_dirs-1))`
do
eval new_dirname=${jj}_type_${ii}
eval source_details=\${HOST_$jj}
eval source_loc=\${${jj}_log_locations[\$ii]}
export ${jj}_type_${ii}="${source_loc}"
echo $ii
done
done
当我运行到调试模式时,下面是输出
# bash -x /tmp/test.sh /u01,/u02
++ echo /u01,/u02
++ sed 's/,/" "/g; s/$/")/g; s/^/("/g'
+ FA_log_locations='("/u01" "/u02")'
+ echo '("/u01"' '"/u02")'
("/u01" "/u02")
+ for jj in FA
+ PASSWORD=
+ USER=
+ eval 'number_of_dirs=${#FA_log_locations[@]}'
++ number_of_dirs=1
++ seq 0 0
+ for ii in '`seq 0 $((number_of_dirs-1))`'
+ eval new_dirname=FA_type_0
++ new_dirname=FA_type_0
+ eval 'source_details=${HOST_FA}'
++ source_details=
+ eval 'source_loc=${FA_log_locations[$ii]}'
++ source_loc='("/u01" "/u02")'
+ export 'FA_type_0=("/u01" "/u02")'
+ FA_type_0='("/u01" "/u02")'
+ echo 0
0
现在我的问题是:
-
为什么要计算目录1而不是目录2。?
-