Bash或GoogleCL:字符串参数中的新行

Doc*_*iki 1 python bash command-line

嗨,我正在使用GoogleCL 0.9.11版将视频上传到Youtube.我的操作系统是CentOS 5.5和Python 2.5.

其中一个字符串参数包含新行"\n",它无法正常显示.

google youtube post ~/videos/cat-falls-down-stairs.avi Comedy --tags "currency of the internet" --summary "Poor whiskers takes a tumble.\nShe's fine, though, don't worry."
Run Code Online (Sandbox Code Playgroud)

摘要页面显示为:

Poor whiskers takes a tumble.\nShe's fine, though, don't worry.
Run Code Online (Sandbox Code Playgroud)

但我想要:

Poor whiskers takes a tumble.
She's fine, though, don't worry.
Run Code Online (Sandbox Code Playgroud)

"\n"不会起作用.谁有解决方案?

非常感谢!

eph*_*ent 9

您可以使用Bash的$''构造在将转义序列传递给googlecl之前展开转义序列.

google youtube post ~/videos/cat-falls-down-stairs.avi Comedy \
    --tags 'currency of the internet' \
    --summary $'Poor whiskers takes a tumble.\nShe'\''s fine, though, don'\''t worry.'
Run Code Online (Sandbox Code Playgroud)