bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash shows an error message about unpaired quotes, but they are pair


From: Chet Ramey
Subject: Re: bash shows an error message about unpaired quotes, but they are paired
Date: Tue, 27 Mar 2018 09:58:29 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 3/26/18 3:54 PM, f.de.kruijf@gmail.com wrote:

> run 'sed -i "6a\find /srv/cowrie/log/ -mtime +7 -name \'cowrie.*\' -delete" 
> cowrietest'

Just so you understand how the quoting works here: you can't escape single
quotes with backslashes inside a single-quoted string. The \'cowrite.*\'
ends the first single-quoted string and inserts a single quote into the
command, since the backslash acts as an escape character in an unquoted
context. The double quote after -delete starts a new double-quoted string,
which is not terminated when the shell reaches the end of the script.

> ./aa.sh: line 16: unexpected EOF while looking for matching `"'
> ./aa.sh: line 17: syntax error: unexpected end of file


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]