Bash allows for piping to stdin from another command in this way...
$ ls /bin/aud* | cat /bin/audacity /bin/audiocompose /bin/audiosend ...
...and this way as well:
$ cat <(ls /bin/aud*) /bin/audacity /bin/audiocompose /bin/audiosend ...
Yet when I tried the same patterns to send a query to SQLite, I got this from the first form...
$ echo "select count(*) from urls;" | \ sqlite3 ~/.config/google-chrome/Default/History 5983
...but this error on the second:
$ sqlite3 ~/.config/google-chrome/Default/History \ <(echo "select count(*) from urls;") Error: near "/": syntax error
This was surprising... The SQL statement is not interpolated or messed up by the shell:
$ echo "select count(*) from urls;" echo "select count(*) from urls;"
And it's not about the
echo either - it can definitely be used in redirecting:
$ cat <(echo Foo) Foo
All I can think of is that somehow the path to the database file is misinterpreted and passed-in as also the SQL statement... (that's the only place containing a '/' - the only explanation for a 'syntax error near /').
Why, though? Any ideas?