当cqlsh命令开始使用scl时,我如何使用它在单行上执行该命令?

2024-06-16 10:23:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试编写一个简单的命令脚本:

/opt/cassandra/bin/cqlsh -e "select * from ntpserver;" localhost

但这不起作用,因为/opt/cassandra/bin/cqlsh实际上是这样的:

allparams=${@} /usr/bin/scl enable python27 'python /opt/cassandra/bin/cqlsh.py $allparams'

如果我尝试使用python cqlsh.py -e "select * from ntpserver;" localhost,我会得到错误CQL Shell supports only Python 2.7,这有助于我理解为什么脚本首先存在。但是,我仍然希望能够使用cqlsh选项,而不必更新Python。我的选择是什么


Tags: frompy命令脚本localhostbinenableusr