【发布时间】:2019-09-13 03:47:13
【问题描述】:
【问题讨论】:
-
非必要请勿截图。在您的情况下,您同样可以直接发布代码,当然要使用正确的格式。您的解决方案不起作用,因为您在子进程中更改了工作目录,而不是在您测试新工作目录的进程中。
【问题讨论】:
试试这个:
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
【讨论】: