将python变量作为参数传递给shell脚本

我有一个调用bash脚本的python脚本,应该将python脚本的变量传递给bash。

title = title + " " + year

这是我的python代码中的title变量,它包含空格,(,数字,各种UTF-8字符。

我的bash脚本

#!/bin/bash
touch /scripts/log.txt
echo "$1" >> /scripts/log.txt

I tried many ways to run the bash script and pass arguments, but I couldn't find how to expand the title variable. The best I got was just printing title into my log file.

如何做到这一点,以使标题正确传递到bash脚本?

评论