D1849.cd-physdir.sh (278B)
1 #!/usr/bin/env bash 2 3 mkdir -p tmp1 4 cd tmp1 5 touch hello.txt 6 (cd ..; mv tmp1 tmp2) 7 save_pwd1=$PWD 8 echo -n "1 $PWD "; pwd 9 ls -la 10 11 echo "# cd -L ." 12 cd -L . 13 PWD=$save_pwd1 14 echo -n "2 $PWD "; pwd 15 16 echo "# cd $save_pwd1" 17 cd "$save_pwd1" 18 echo -n "3 $PWD "; pwd 19 20 21 cd .. 22 rm -rf tmp1 tmp2