Closed danielhoherd closed 5 months ago
sqlite-utils
also does not work with a while
loop.
$ ls *.csv | tail -n1 | while read -r X ; do sqlite-utils insert --csv --pk "User ID" --replace --alter db.sqlite3 "$X" ; done ;
Usage: sqlite-utils insert [OPTIONS] PATH TABLE FILE
Try 'sqlite-utils insert -h' for help.
Error: Missing argument 'FILE'.
Or subshells
$ sqlite-utils insert --csv --pk "User ID" --replace --alter db.sqlite3 $(ls *.csv | tail -n1)
Usage: sqlite-utils insert [OPTIONS] PATH TABLE FILE
Try 'sqlite-utils insert -h' for help.
Error: Missing argument 'FILE'.
$ sqlite-utils insert --csv --pk "User ID" --replace --alter db.sqlite3 `ls *.csv | tail -n1`
Usage: sqlite-utils insert [OPTIONS] PATH TABLE FILE
Try 'sqlite-utils insert -h' for help.
Error: Missing argument 'FILE'.
After drinking some coffee, and reading the help text, and thinking "surely it can't fail in all these ways", I see I have a syntax error in my examples. 🤦♂️
Description
When using
xargs
, thesqlite-utils
command fails. If we copy the exact command thatxargs -t
showed and run it manually, the command succeeds.Example
Tested environments