【发布时间】:2011-11-24 08:35:29
【问题描述】:
我想像这样在 Bash 中显示一个字符串
I'm a student
当然可以这样
echo "I'm a student"
但是如何在字符串周围使用单引号来实现这一点?
【问题讨论】:
-
对不起,没有办法在单引号之间放置单引号。请参阅
3.1.2.2 Single Quotes部分的gnu.org/software/bash/manual/bashref.html#Special-Parameters -
那在脚本中,你是怎么做的?
su -c '/etc/init.d/myservice start' -l myuser(由 root 运行)