答案 0 :(得分:0)
尝试一下:
var=( /home/divya/dir1 /home/divya/dir2 )
for dir_list in ${var[@]}
do
cd "${dir_list}"
test="$(pwd)"
if [ "${dir_list}" = "${test}" ] ; then
echo "Destination directory is ${test}"
else
echo "Check the destination directory"
fi
done