Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

problem with terminal: (dquote cmdsubst>)

Hi everyone,




Excuse me for the inconvenience ... and thank you in advance ,.




So here is my problem:




Lately I've been having fun with home brew on the Mac, and everything is fine until I run the brew doctor command,




He found a small problem and offered me a correction,




  Here is all the text he gave me:




(Please note that these warnings are just used to help the Homebrew maintainers








with debugging if you file an issue. If everything you use Homebrew for is








working fine: please don't worry or file an issue; just ignore this. Thanks!
















Warning: Homebrew's sbin was not found in your PATH but you have installed








formulae that put executables in /usr/local/sbin.








Consider setting the PATH for example like so:








  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc)




So naturally I did what he asked me to do, which was to run the following command line:




echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc




The concern is that the command did not solve the little problem with homebrew but even worse ... it created a new, more serious problem for me:




Now all the scripts I want to run give me the same result:




(Dquote cmdsubst>)




Example of the scripts I want to use, the official homebrew uninstall script:




/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh






And it gives me the same result, (dquote cmdsubst>), yet I tried in the past to run the same script before and it worked, meaning I managed to uninstall home brew,


but after brew doctor's manipulations the script no longer works,


To be honest… I'm not familiar enough with the terminal… so I absolutely don't understand what all of this means and I don't want to know it,


What I want is for the terminal to return to its usual behavior so that I can reuse scripts normally.


That's the whole problem, I apologize again for this long text,


Cordially.

MacBook Pro with Touch Bar

Posted on Jan 4, 2021 11:15 AM

Reply
Question marked as Best reply

Posted on Jan 4, 2021 11:41 AM

You will need to edit your .zshrc file and remove that last line. It is a hidden file, so you will have to type shift+command+period in order to see it. Use something like BBEdit, which is always a good thing to have.


You can fix it in the Terminal by manually running a different shell. In the Terminal app, go to the "Shell" menu and choose "New Command..." In the "New Command" window that pops up, enter the following:


/bin/bash


and click the "Run" button.


This will open a new Terminal using bash instead of zsh. From there, you can use vi or other command-line text editors to fix the .zshrc file.


There is no way to tell what went wrong the the command you typed. Perhaps you forgot one of the quotes. Or perhaps something auto-corrected them to smart quotes.


Here is a trick for the future. Whenever you need to make edits to a shell dot file like this, always have a couple of additional shells running. Then, after you make the change, open up a new shell to make sure it works. If it doesn't, then you can still use your old shells to fix the problem because they won't be scrambled until you quit them. So don't quit them until you fix it.

Similar questions

12 replies
Question marked as Best reply

Jan 4, 2021 11:41 AM in response to Platinum-Akari

You will need to edit your .zshrc file and remove that last line. It is a hidden file, so you will have to type shift+command+period in order to see it. Use something like BBEdit, which is always a good thing to have.


You can fix it in the Terminal by manually running a different shell. In the Terminal app, go to the "Shell" menu and choose "New Command..." In the "New Command" window that pops up, enter the following:


/bin/bash


and click the "Run" button.


This will open a new Terminal using bash instead of zsh. From there, you can use vi or other command-line text editors to fix the .zshrc file.


There is no way to tell what went wrong the the command you typed. Perhaps you forgot one of the quotes. Or perhaps something auto-corrected them to smart quotes.


Here is a trick for the future. Whenever you need to make edits to a shell dot file like this, always have a couple of additional shells running. Then, after you make the change, open up a new shell to make sure it works. If it doesn't, then you can still use your old shells to fix the problem because they won't be scrambled until you quit them. So don't quit them until you fix it.

Jan 4, 2021 5:14 PM in response to Platinum-Akari

Platinum-Akari wrote:

That was exactly the problem,
The script was waiting for a second quote because I accidentally inserted the first one.
Anyway thank you very much for your feedback, I almost reset my Mac because of a small typo,
Cordially.



In all fairness I see very clearly from above—


etresoft wrote:
There is no way to tell what went wrong the the command you typed. Perhaps you forgot one of the quotes. Or perhaps something auto-corrected them to smart quotes.

Jan 4, 2021 11:26 AM in response to Platinum-Akari

Platinum-Akari wrote:

problem with terminal: (dquote cmdsubst>)

Hi everyone,
Excuse me for the inconvenience ... and thank you in advance ,.
So here is my problem:
Lately I've been having fun with home brew on the Mac, and everything is fine until I run the brew doctor command,
He found a small problem and offered me a correction,
Here is all the text he gave me:
(Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.

Consider setting the PATH for example like so:
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc)

So naturally I did what he asked me to do, which was to run the following command line:
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc

The concern is that the command did not solve the little problem with homebrew but even worse ... it created a new, more serious problem for me:
Now all the scripts I want to run give me the same result:
(Dquote cmdsubst>)
Example of the scripts I want to use, the official homebrew uninstall script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh

And it gives me the same result, (dquote cmdsubst>), yet I tried in the past to run the same script before and it worked, meaning I managed to uninstall home brew,
but after brew doctor's manipulations the script no longer works,

To be honest… I'm not familiar enough with the terminal… so I absolutely don't understand what all of this means and I don't want to know it,
What I want is for the terminal to return to its usual behavior so that I can reuse scripts normally.
That's the whole problem, I apologize again for this long text,
Cordially.



reposted for readability—Lets see if we can get you some help here

Jan 4, 2021 1:39 PM in response to Platinum-Akari

Platinum-Akari wrote:

Thank you very much for your answer,
I tried to search for the .zshrc file you were talking about and I couldn't find it, I searched my user folder with the hidden files displayed and nothing either, ...


You can verify the existence/content of your .zshrc


from Terminal copy and paste:

cat ~/.zshrc



and from the Finder>Go>Go to Folder (if you have .hidden files visible) copy and paste:

~/.zshrc

Jan 4, 2021 2:25 PM in response to Platinum-Akari

Platinum-Akari wrote:

Thank you very much for your answer,
I tried to search for the .zshrc file you were talking about and I couldn't find it, I searched my user folder with the hidden files displayed and nothing either, ...

Maybe the try the above command to get a shell, then type the following two commands:


tail ~/.zsh_history

tail ~/.history


and paste the results in a reply here. That should tell us exactly what you did.

Jan 4, 2021 3:41 PM in response to Platinum-Akari

after some research ... I discovered that the problem is with the interpretation of shell to special characters in scripts, (like quotes "),


I'm reposting the script I'm trying to use:




/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh




What I find weird ... is that I've never encountered this problem before, and I'm 100% sure that in the past I've used this kind of script with quotes and everything was fine,


Why is it not working anymore? Did I accidentally change any options in the shell?


I am really lost.

Jan 4, 2021 4:28 PM in response to Platinum-Akari

I asked you to use the tail command. The only command anyone wants to see is the last one that scrambled your shell.


I'm afraid that if you chose to improvise on something as basic as this, chances are that you improvised on the other one too.


It should be obvious what the problem with that curl command is. If it isn't obvious, then stop now. And for the record, don't ever, ever, ever feed the output from a curl command into bash. That will mess you up but good.

problem with terminal: (dquote cmdsubst>)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.