ubuntu@shanghai:~ $ ls -l /sbin/halt
lrwxrwxrwx 1 root root 14 Feb 5 2020 /sbin/halt -> /bin/systemctl
ubuntu@shanghai:~ $ halt
Failed to set wall message, ignoring: Interactive authentication required.
Failed to halt system via logind: Interactive authentication required.
Failed to open /dev/initctl: Permission denied
Failed to talk to init daemon.
ubuntu@shanghai:~ $ systemctl
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Forma
sys-devices-pci0000:00-0000:00:01.1-ata1-host0-target0:0:1-0:0:1:0-block-sr0.device loaded active plugged QEMU_DVD-ROM config-2
sys-devices-pci0000:00-0000:00:05.0-virtio0-net-eth0.device loaded active plugged Virtio network device
ubuntu@shanghai:~ $ whereis halt
halt: /sbin/halt /usr/share/man/man8/halt.8.gz
ubuntu@shanghai:~ $ /sbin/halt
Failed to set wall message, ignoring: Interactive authentication required.
Failed to halt system via logind: Interactive authentication required.
Failed to open /dev/initctl: Permission denied
Failed to talk to init daemon.
ubuntu@shanghai:~ $ ls -l /sbin/halt
lrwxrwxrwx 1 root root 14 Feb 5 2020 /sbin/halt -> /bin/systemctl
ubuntu@shanghai:~ $ whereis systemctl
systemctl: /bin/systemctl /usr/share/man/man1/systemctl.1.gz
ubuntu@shanghai:~ $ which systemctl
/bin/systemctl
ubuntu@shanghai:~ $ cat hello.sh
echo Hello World
echo $0
ubuntu@shanghai:~ $ bash hello.sh
Hello World
hello.sh
ubuntu@shanghai:~ $ ln -sf hello.sh world
ubuntu@shanghai:~ $ bash world
Hello World
world
这个 里面是针对$0来再进行一次判断执行的命令是什么,至于在ubuntu中把sh指向bash会出现不一样的情况应该也是这个原因导致的。