Bash或GoogleCL:一个字符串参数中的新行 [英] Bash or GoogleCL: new line in a string parameter

查看:304
本文介绍了Bash或GoogleCL:一个字符串参数中的新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using GoogleCL version 0.9.11 to upload videos to Youtube. My OS is CentOS 5.5 and Python 2.5.

其中一个字符串参数包含新行\\\
,无法正确显示。

One of the string parameters contain new line "\n", and it cant display properly.

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."

摘要页显示为:

Poor whiskers takes a tumble.\nShe's fine, though, don't worry.

但我想要:

Poor whiskers takes a tumble.
She's fine, though, don't worry.

\\\
无效。谁有解决方案?

The "\n" wont work. Who has a solution?

非常感谢。

推荐答案

可以使用Bash的 $'' 构造,以便在将转义序列传递给googlecl之前展开它们。

You can use Bash's $'' construct to expand escape sequences before they are passed to 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.'

这篇关于Bash或GoogleCL:一个字符串参数中的新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆