Linux shell scripting error for double quotes sentence closing [closed]
Asked Answered
C

11

147

When I execute a script in a Linux shell, I get this output:

dquote>

What does this mean?

Capper answered 2/4, 2013 at 20:0 Comment(0)
S
183

It means you've executed a line of code with only one double-quote character, like this:

echo "Hello

The shell is waiting for the other quote.

Shoop answered 2/4, 2013 at 20:2 Comment(8)
And I found that CTRL+G was the only way to undo my command. As entering " will execute something you maybe had mistyped.Hypergolic
I was working in MobaXTerm w/ OhMyZSH shell and this worked perfectly for me.Eloiseloisa
This worked for me. Just added one more " and pressed enter.Barros
This can also occur in those cases when you use two different type of quotation mark. Therefore it's worth to replace the quotation marks if you copied the command from somewhere else on the net.Horrendous
@PierreMaoui - you should add your as a full-blown answer, as it's the safest way to get out of the situation, and it's easy to miss here in the comments. (And thanks for pointing it out - was exactly what I needed!)Enthronement
The mystery was why it was waiting for a second double quote. The solution was that I had cut and pasted the command from an e-mail, and some text editor had replaced the first double quote character with a Unicode double-backquote. These looked almost the same in my editor font. I noted this at the bottom, but I feel I should repeat it next to the most read comment, in case someone else falls down this hole.Uncomfortable
which shortcut is there for AppleOS?Taphole
For me I'd pasted in a command with a quote and it had been converted to a curly/smart quote.Tungusic
O
64

If you have an ! in a quoted string like password="this1smyp4ssword!" it will also end with dquote>

Orcutt answered 13/12, 2020 at 12:29 Comment(8)
What shell and what version are you using. I either get an error in [email protected] or it gets ignores in [email protected] The comment might be outdated, but I'm not sureStephan
I'm using zsh 5.7.1 (x86_64-apple-darwin19.0)Orcutt
That's weird, I tried it again from another Mac also with [email protected] (x86_64-apple-darwin20.0) and now it workedStephan
Guess I was using single quotes, that's why it didn't workStephan
This is because of history expansion being enabled and can be escaped with a backslash, \!Renaterenato
That was exactly my case.Mieshamiett
zsh 5.8.1 on Debian; I get dquote> when exclamation mark is last character in the string. Thanks @RicoNeitzelSchwab
@Schwab I found that if you do password="this1smyp4ssword\!", it will not do dquoteJamesy
N
18

When you have "dquote>" on terminal, do not worry just press double quotes button on keyboard for EXIT:

"

Screenshot example:

enter image description here

Nureyev answered 30/1, 2021 at 22:4 Comment(0)
H
12

The shell is waiting for the other quote of an unfinished command.

CTRL+G will leave that state and undo the command.

Entering " and pressing enter is an other way to leave but it will execute something you may had mistyped.

Hypergolic answered 29/1, 2022 at 15:20 Comment(2)
yes, this is the best way to solve the problem.Venita
This is the best answer - works for other modes (i.e. not just dquote but also cmdsubst, for, etc, where you might not know how to close it); doesn't execute the command you almost certainly wish to cancel; and works in most shells!Transgression
G
5

If we have an exclamation symbol in the password, for example like password="passwordhas!symbol" it will also end with dquote>

To get rid of dquote, use a single quote, as shown below. password='passwordhas!symbol'

Griffey answered 28/1, 2021 at 3:22 Comment(1)
or escape the exclamation: \!Schwab
A
3
dquote> 

The above prompt surely means that you have to de-quote the starting of the quote, i.e. ", with another quote: ".

Please write a letter i.e another: " in the dquote> prompt.

Alcazar answered 7/5, 2020 at 13:29 Comment(0)
D
2

You need to use a pair of double quotes in your text.

The shell is waiting for you to add a second double quote ", hence the prompt dquote>. Add and this prompt will go away.

The same applies for single quotes '

Diastrophism answered 2/5, 2022 at 0:50 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Streamy
R
2

It might mean that you have escaped the ending double quotes while running the command. like:-

echo "Hello\"

So you need to provide one more double quote.

Reichstag answered 13/6, 2022 at 10:29 Comment(0)
O
2

This just happened to me and when I typed " and pressed enter, it led to > being shown. If this happens to you, just press control-c

Osmic answered 27/4, 2023 at 18:40 Comment(0)
U
1

NB: check the double quotes in your line are ordinary ASCII double quotes.

I had a command cut from an e-mail, and was getting the 'dquote>' prompt. It turns out the text editors had replaced the final double quote with a double backquote, which can look almost identical. If in doubt, delete and retype all double quotes.

Uncomfortable answered 3/12, 2021 at 9:58 Comment(0)
S
-1

You need to use single quotes instead of double quotes and make sure they are closed.

"Hello" should be 'Hello'

'Hello should be 'Hello'

Steinberg answered 8/4, 2023 at 11:37 Comment(3)
What do you mean by this? The OP hasn't shared anythign that contains quotes, and there are already other answers mentioning quotes. Please do not duplicate them, unless you want to share new insightsScaramouch
@NicoHaase You misunderstood my answer. There's no answer that mentions you should use single quotes when double quotes are not working. In my case my double quotes matched but was still giving the issue. Changing them to single quotes workedSteinberg
Feel free to add all clarification to your answer by editing it. Using matchin pairs of quotes has already been recommended in the other answers. What do you want to add to them?Scaramouch

© 2022 - 2024 — McMap. All rights reserved.