我编写了一个Bash脚本来向
sqlite
数据库中插入值。命令如下:sqlite3 ${db_name} "insert into ${table_name} (${column1},${column2}) values ('$f1','$f2');"
这个命令在f1
变量中包含单引号时会出现问题
# e.g f1="I'm just kidding"
# the command reported error
Error: near "m": syntax error
请问如何在变量内转义单引号?欢迎提供建议,谢谢!