"zsh: no matches found": How can I switch from zsh to bash and back?

So I ran into this very annoying quality of Zsh that it treats certain characters differently in the middle of a command (at least I believe that’s the reason for this unexpected behavior):

john --format=bitlocker-opencl --mask=?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d ~/bitl-recoverypw-hash 
zsh: no matches found: --mask=?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]?d?d?d?d?d?d

I tried escaping all the ? with a backslash:

--mask=\?d\?d\?d\?d\?d\?d[-]\?d\   //and so on

=> same error, quoting my input without the backslashes though.

No I tried to switch to Bash doing this:

su
chsh -s /bin/bash root
chsh -s /bin/bash ben

but, for some reason:

➜  ~ echo $0
/bin/zsh

Apparently, my shell is still Zsh. The only effect chsh apparently had was that the command prompt no looks differently, it changed from the Manjaro logo with the house icon to just this: ➜ ~

Questions:

  1. Is Zsh’s different interpretation of characters actually the reason for “zsh: no matches found” or did someone on stackexchange just fool me?
  2. If yes, how to correctly switch between Zsh and Bash?

EDIT: Maybe this has some sort of significance:

➜  ~ cat /etc/shells
# Pathnames of valid login shells.
# See shells(5) for details.
/bin/sh
/bin/bash
/bin/zsh
/usr/bin/zsh
/usr/bin/git-shell

/usr/bin/bash seems to be missing?

EDIT2: I also tried wrapping the string in double quotes like so --mask="?d?d?d?d?d?d[-]?d?d?d?d?d?d[-]", which does make zsh happy and causes the command to run, but it results in errors that make no sense, so I’m not sure if the program interprets it as intended and wanted to eliminate that possibility by using bash with no need for extra characters.

Hello,

When using zsh you need to add ' ' quotes.

So --mask='\?d\?d\?d\?d\?d\?d[-]\?d\' should work I think. You can try with your first command if this
doesn’t work but you must have quotes.

In order to switch fast (if your default shell is zsh) you just type bash in your terminal and it should switch you into bash for the current open window / tab.

Hope this helps.

Cheers…

It depends on how you call the shell. For example, if you use Konsole in KDE Plasma, you need to set the default shell in the Konsole profile like below.

Thank you. Single quotes work as well as double quotes. Any idea why the esacping with \ does not work though?
Tried with typing bash first and ran the command in Bash and got the same errror as with Zsh, so now I know at least the problem is not the input.

In zsh, when using double quotes and \ than you need to use triple \\\ in order to escape its complicated. Hell breaks lose :smiley:
I had problems once using rg and regex in terminal. So I found out that when you use single quotes
and regex, everything works as expected.
So single quotes + \ escapes properly.

In regards to your command maybe you should try this \d?\d?… and so on…
Because if this is some kind of regex you are trying to escape literal d so it becomes a number and the ? means zero or one of the previous character or number in your case.

But I don’t know what is this command and what are you trying to achive… :man_shrugging:

EDIT If this is regex you start with --mask='/\d?...... and so on... close it with -> /'.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.