wp.jochen.hayek.name/blog-en

shell command completion with busybox-w32 resp. its “ash”

With Bash command completion works the way, I expect it – or through all the years with Bash I learned what to expect: If I try to complete through a relativ or absolute directory, it lets me complete (sub)directory names and names of executable files.

With ash (under busybox-32) initially I had trouble getting certain executables recognised by command completion. It turned out, I only had trouble with shell scripts. And that was because my shell scripts did not have a shebang line:

That’s because I “always” want to get them run through THE STANDARD system shell, and this is being achieved through not using a shebang line – so (under “normal” circumstances) why should I let them have a shebang line?

On busybox-w32 shell scripts w/o shebang line get properly executed – but they are not considered for command completion.

That’s a phenomenon resp. approach I had never come across before. And because I could not guess it by myself (and I falsely assumed the “ash” would consider the file extension), I created an “issue” here:

The reply:

In this context the file extension doesn’t matter. A text file is considered to be executable if the first characters are “#!“.

And it works exactly as described.

On Windows there is not “executable bit”, as on Unix/Linux/… filesystems. So busybox-w32 (or BusyBox in general?!?) looks at the “shebang”, and if there is one, the file is considered for command completion.

Exit mobile version