您好我有以下脚本:
#!/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
我在那里使用它:
./snp_id_list.sh <myGene>
但是我得到了:
./snp_id_list.sh: 3: Syntax error: Unterminated quoted string
我不认为我正在绕$1
的第一个实例正确地转义双引号(有一次我在mysql语法中调用它)
答案 0 :(得分:1)
根本不需要双引号。以下应该有效:
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
(为了便于阅读,我将其设为多行语句)