0

The following works great:

ssh plxch1035.pdx.xxxxxx.com "sqlite3 /p/hdk/rtl/proj_data/shdk74/fe_data/ipci/ipci.db 'select * from tools'"

When I want a specific tool row though:

ssh plxch1035.pdx.xxxxxx.com "sqlite3 /p/hdk/rtl/proj_data/shdk74/fe_data/ipci/ipci.db 'select * from tools where name='bscan''"

The error is

SQL error: no such column: bscan

I have confirmed the existence of the column name has bscan.

I am assuming my quotes are messed up and I even tried escaping the single quotes around bscan (using ''')

1 Answer 1

1

OT1H ssh does not require that the remote command line be a single argument; OTOH getting quotes through both the local shell (to ssh) and the remote shell (to sqlite3) is difficult, but sqlite3 accepts SQL command(s) (with ;) on stdin instead of as an argument which is easier because ssh normally passes through stdin (and stdout and stderr) transparently:

 echo "select * from tools where name='bscan';" | ssh [user@]host sqlite3 db

or if your shell supports herestring (bash, ksh, zsh):

 ssh [user@]host sqlite3 db <<<"select * from tools where name='bscan';"
1
  • Definitely glad you showed up thank you for the help. Works like a charm!
    – mcwilk
    Commented Nov 16, 2017 at 2:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .