I have met a question when using cd command in a script. here is the test below, so, could anyone help to tell the reason?
why does not "/bin/sh cd /root/eos/" work ,but "/bin/sh -c ls && cd /root/eos/" works well in centos thanks.
[root@izbp16eo65uiwii1mfm63tz eos]# pwd /root/testeosnode/CryptoKylin-Testnet/docker/eos [root@izbp16eo65uiwii1mfm63tz eos]# /bin/sh cd /root/eos/ [root@izbp16eo65uiwii1mfm63tz eos]# pwd /root/testeosnode/CryptoKylin-Testnet/docker/eos [root@izbp16eo65uiwii1mfm63tz eos]# /bin/sh -c ls && cd /root/eos/ build.log build.sh Dockerfile eos [root@izbp16eo65uiwii1mfm63tz eos]# pwd /root/eos
env CentOS Linux release 7.5.1804 (Core) [root@izbp16eo65uiwii1mfm63tz eos]# ls -l /bin/sh lrwxrwxrwx 1 root root 4 10oct 9 18:00 /bin/sh -> bash