Q:

Debian Jessie initramfs-tools strange behavior

My current system is:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.1 (jessie)
Release:    8.1
Codename:   jessie

with kernel:
$ uname -a
Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux

I updated to new kernel with:
$ sudo apt-get install linux-image-3.16.0-4-amd64
....
Setting up linux-image-3.16.0-4-amd64 (3.16.7-ckt11-1+deb8u2) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-3.16.0-4-amd64
/usr/share/initramfs-tools/hooks/fsck: syntax error at line 60: `MNT_FSNAME=$' unexpected
/usr/share/initramfs-tools/hooks/keymap: syntax error at line 57: `value=$' unexpected
/usr/share/initramfs-tools/hooks/resume: syntax error at line 44: `RESUME=$' unexpected
/usr/share/initramfs-tools/hooks/zz-busybox: syntax error at line 33: `$' unexpected
/usr/share/initramfs-tools/scripts/init-premount/plymouth: syntax error at line 19: `$' unexpected
/usr/share/initramfs-tools/scripts/init-top/all_generic_ide: syntax error at line 16: `$' unexpected
....

I noticed errors from /usr/share/initramfs-tools/hooks/fsck script, I check it and notice that it start with #!/bin/sh and line 60 is:
MNT_FSNAME=$(resolve_device "$MNT_FSNAME")

Well, I see that the error is from command substitution syntax. My /bin/sh is symlink to dash and dash of course support that syntax.
My system also have sh from heirloom tool chests, which was installed in /usr/5bin/sh, and that shell does not support $(...) syntax. So It seems that the script had been run with that shell instead of /bin/sh as its shebang.
What make that weird behavior and how to solve it?
Updated
There's also a /sbin/sh which is a symlink to /usr/5bin/sh. The problem solved after I removed this link. So the process that update initramfs seem to use it instead of /bin/sh.

A:

The reason is script which ran the initramfs hook was called with /sbin/sh, which is old Bourne shell from heirloom tool chests in my system, instead of /bin/sh.
A strace can verify it:
$ strace -fe execve apt-get install linux-image-3.16.0-4-amd64
...
22900 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=22918, si_status=0, si_utime=0, si_stime=0} ---
22919 execve("/sbin/sh", ["sh", "-n", "/usr/share/initramfs-tools/hooks"...], [/* 40 vars */]) = 0
...

