Search code examples
shesxi

Shell alias expansion under ESXi host does not auto complete - AND - detecting if running interactively


Since ESXi does not come with bash, I am sourcing an .sh file to set up some custom aliases for common commands while connected via ssh.

On other distros like RHEL, I can type part of an alias and hit tab to autocomplete. This does not seem to work under ESXi 7.x.

Is there a switch or something that I can turn on to make autocomplete work for custom aliases, or is this just a limitation of the shell that ESX offers? NOTE: If type l<tab> then I DO get the built in commands that start with L.

Also while I'm on the topic of the ESXi shell… On RHEL I have this line in my .bashrc file

[[ $- != *i* ]] && return 

Purpose of this code being that if the current session is not being ran interactively then return else run rest of code.

When I run this on esx I get the error sh: *i*: unknown operand. Does the shell not support this substring methodology?

If I run echo $- then I get “smi” as the output.

Thanks


Solution

  • As you probably know ESXi provides ash (NOT bash) and Busybox. Although Busybox includes ash as I recall ESXi uses a custom built executable (check where /bin/ash points or doesn't point to). The Wikipedia article on ash gives a good overview of ash and its minimalist philosopy. Shell history was originally not included and autocompletion is definitely regarded as a nice to have that didn't make the cut. Sorry to be the bearer of bad news.