您的位置:首页 > 运维架构 > Shell

shell $'somestring'

2013-12-01 11:10 246 查看
IFS默认支持 空格 tab 换行符

改变 IFS

IFS=$'\n'

IFS='\n'

IFS=\n

Normally
bash
doesn't interpret escape sequences in string literals. So if you write
\n
or
"\n"
or
'\n'
, that's not a linebreak - it's the letter
n
(in the first case) or a backslash followed by the letter
n
(in the other two cases).


$'somestring'
is a syntax for string literals with escape sequences. So unlike
'\n'
,
$'\n'
actually is a linebreak.




内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: