相关疑难解决方法(0)

Bash中单引号和双引号之间的区别

在Bash中,单引号('')和双引号("")之间有什么区别?

syntax bash shell quotes

501
推荐指数
6
解决办法
17万
查看次数

何时在shell变量周围包装引号?

有人能告诉我是否应该在shell脚本中包含变量的引号?

例如,以下是正确的:

xdg-open $URL 
[ $? -eq 2 ]
Run Code Online (Sandbox Code Playgroud)

要么

xdg-open "$URL"
[ "$?" -eq "2" ]
Run Code Online (Sandbox Code Playgroud)

如果是这样,为什么?

unix linux bash shell quotes

145
推荐指数
4
解决办法
5万
查看次数

Bash:单引号变量

首先来看看这个问题: Bash或GoogleCL:字符串参数中的新行

我想现在在"摘要"中添加一个变量$ {date}:

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

但变量不会在bash中的单引号内扩展.

有可能这样做吗?

注意:GoogleCL是一个用python编写的命令行程序.我使用的是Python 2.6的Ubuntu 10.10.

python linux bash command-line googlecl

4
推荐指数
2
解决办法
6463
查看次数

有没有办法内联 Unicode 转义序列?

这有效:

ghost=$'\U1F47B'
PROMPT='time: %T $ghost > '
Run Code Online (Sandbox Code Playgroud)

但是有没有办法内联 Unicode 字符的十六进制版本呢?

unicode bash hex zsh sh

0
推荐指数
1
解决办法
873
查看次数

标签 统计

bash ×4

linux ×2

quotes ×2

shell ×2

command-line ×1

googlecl ×1

hex ×1

python ×1

sh ×1

syntax ×1

unicode ×1

unix ×1

zsh ×1