I had an issue where logging in to a terminal on this laptop would lock up (but ...

@rl_dane@polymaths.social

I had an issue where logging in to a terminal on this laptop would lock up (but would continue if I hit Control+C). I traced it to a line in my .bash_functions:

if inst trans && grep -q 'Translate Shell' $(which trans); then

It was locking up, because inst (defined as function inst { type "$@" >/dev/null 2>&1; }) was returning a 0, but then $(which trans) wasn't giving any output.

I opened a terminal, hit Control+C, and ran (and got) the following:

rld@prometheus:~$ type trans
trans is /home/rld/.local/bin/trans
rld@prometheus:~$ which trans
rld@prometheus:~$

HOW?!?!?

My fix was to change that line to:

if inst trans && grep -q 'Translate Shell' $(which trans) </dev/null; then

To force grep to not hang.

Now both type and which find it:

rld@prometheus:~$ type trans
trans is /home/rld/.local/bin/trans
rld@prometheus:~$ which trans
/home/rld/.local/bin/trans
rld@prometheus:~$ which -a trans
/home/rld/.local/bin/trans
rld@prometheus:~$ 

I'm so confuzzled.

But when I revert that change, I'm back to this!

rld@prometheus:~$ type trans
trans is /home/rld/.local/bin/trans
rld@prometheus:~$ which trans
rld@prometheus:~$ echo $?
1
rld@prometheus:~$ which -a trans
rld@prometheus:~$ echo $?
1
rld@prometheus:~$

Very confused. XD