I ran into an interesting problem while developing a gem that only seems to happen on Ubuntu. My Ruby is version 2.2.2 installed with the rbenv tool. I am building a CLI (Tool A) that depends on another utility (Tool B) being installed on the machine. At the point when Tool B is called there is a guard clause that prints an error message if Tool B isn't found, like this:
fail "Can't do it: missing 'Tool B' utility" unless system("hash tool-b")
fail "Can't create cartridge: missing 'cartridge' utility" unless system("hash cartridge") # offending Ruby code
### UBUNTU COMMAND LINE
$ hash cartridge
$ echo $?
### UBUNTU IRB
=> ... exit 127
### OSX IRB
=> ... exit 0
Kernel#system uses the system shell, i.e.
/bin/sh to execute.
hash was only added to the Base System in POSIX.2013, before that, it was optional. I believe
dash, the default system shell Ubuntu uses is not yet POSIX.2013 compliant, and thus does not have
macOS / OSX uses Bash as its system shell, which does have