I have Bash completion for JTR setup as recommended:
Enable bash completion. add the following line to your
~/.bashrc.
<JtR path>/run/john.bash_completion
Therefore I have this in .bashrc:
. /mnt/data/Documents/Build/JohnTheRipper/run/john.bash_completion
This works fine, and I can Bash complete when calling the john binary.
However, I made a script called johnit so I can call John The Ripper with various modes, wordlists and rules in one shot.
As noted in the comments within john.bash_completion I used the following syntax to "copy" the bash completion rules to johnit:
complete -F _john johnit
johnit resides in ~/bin/johnit and this is in the current user's $PATH.
However, when tab completing with johnit the shell hangs and never autocompletes.
As a test I tried this with another, empty, file, marked as executable:
touch magic
chmod +x magic
And this appears to autocomplete but only without the leading dot and slash (./magic) so Bash wouldn't actually call it properly when executed:
magic --format=
What gives?