0

Hi I have the following script:

#!/bin/sh
mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A hg19 -D hg19 -e "select distinct c.name,c.transcript from  (select distinct kgID,genesymbol,refseq from kgXref where genesymbol = '"${1}"') a inner join (select * from knownGene) b on a.kgID = b.name inner join (SELECT distinct name, transcript,chromStart,chromEnd, substr(peptides,1,1) as ref_pep,substr(peptides,3,1) as mut_pep FROM snp141CodingDbSnp) c on a.refseq = c.transcript" > ${1}id.txt

where I use it like:

./snp_id_list.sh <myGene>

However I get:

./snp_id_list.sh: 3: Syntax error: Unterminated quoted string

to which I don't think I am escaping the double quotes correctly around the first instance of $1 (the one time I call it within the mysql syntax)

1
  • 1
    You may use simply '$1'. Commented Oct 6, 2015 at 15:24

1 Answer 1

1

The double quotes are not needed at all. The following should work:

mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A hg19 -D hg19 -e \
    "select distinct c.name,c.transcript from \
    (select distinct kgID,genesymbol,refseq from kgXref where genesymbol = '${1}') a \
    inner join (select * from knownGene) b on a.kgID = b.name \
    inner join (SELECT distinct name, transcript,chromStart,chromEnd, substr(peptides,1,1) as ref_pep,substr(peptides,3,1) as mut_pep \
    FROM snp141CodingDbSnp) c on a.refseq = c.transcript" > ${1}id.txt

(I made it a multi line statement for sake of readability)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.