python - 如何编辑参数格式
问题描述
我有一个 python 脚本......它的调用方式与 bash 不同
./script.py 'arg1' 'arg2 stillarg2'
在 python 脚本中有两个参数。
现在我想用 bash 脚本调用它
#!/bin/bash
./script.py ${1} ${2} ${3}
我想用这种语法调用 bash 脚本
./script.sh arg1 arg2 stillarg2
在 Bash 脚本中有 3 个参数并且没有引号。
那么有没有一种方法可以通过使用 bash 脚本来调用带有参数的 python 脚本。没有引号和 3 个参数?
我试过了:
#!/bin/bash
./script.py "'${1}'" "'${2} ${3}'"
结果是:
operation not support
解决方案
你只是想在同一个论点中结合$2
和,不是吗?$3
#!/bin/bash
./script.py "${1}" "${2} ${3}"
推荐阅读
- swift4.2 - 如何在过滤器不起作用时进行正确的搜索
- python - 迭代三行然后进行线性回归
- msbuild - 错误 MSB3086:任务无法使用 SdkToolsPath“”找到“LC.exe”
- apache-spark - Hive Warehouse Connector + Spark = 签名者信息与同包中其他类的签名者信息不匹配
- android - Android Mapbox如何在使用CirclceClustering层时捕获标记点击
- mysql - 列计数与第 1 行的值计数不匹配
- getgauge - 仪表插件记录器
- eclipse - 当我在 Eclipse 中使用带有 Maven 的黄瓜时,它无法识别 @given、@when、@then
- python - AttributeError:Seaborn 点图的未知属性 y
- asynchronous - 等待未来飞镖超时