我想知道是否有办法这样做:
lab-2:/tmp# echo 46692,46694,46696,46704,46708,46709,46713,46730,46736,46574 > deletelist.txt
lab-2:/tmp# cat deletelist.txt
46692,46694,46696,46704,46708,46709,46713,46730,46736,46574然后,我想通过psql将列表传递到删除命令中。到目前为止,这是我尝试过的,但正如你所看到的,它是失败的:
lab-2:/tmp# psql -U test testdb -c "Delete from widgets where id in (" EDIT 1
试图给出建议的答案会得到以下结果:
lab-2:/tmp# psql -U test testdb -c "delete from widgets where id in ( $(在没有路径的情况下也尝试了相同的命令,如下所示:
lab-2:/tmp# psql -U test testdb -c "delete from widgets where id in ( $(但同样的结果
发布于 2018-03-01 19:43:29
尝试在命令替换中使用。
psql -U test testdb -c "Delete from widgets where id in ( $(https://unix.stackexchange.com/questions/427538
复制相似问题