linux - 什么(: ${foo%%bar}) mean in unix shell

标签 linux bash shell unix

<分区>

#!/bin/sh
unset foo
(: ${foo%%bar}) 2> /dev/null
E1="$?"

我知道foo是一个变量,${foo%%bar}表示删除最后一个 bar$foo .
但是 (: ) 是什么意思?意思是那里?

我是 shell 的新手,有人可以帮助我吗?谢谢!

最佳答案

http://tldp.org/LDP/abs/html/special-chars.html

与 >> 重定向运算符结合使用,对预先存在的目标文件 (: >> target_file) 没有影响。如果该文件以前不存在,则创建它。

关于linux - 什么(: ${foo%%bar}) mean in unix shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44406872/

相关文章:

linux - 为什么结束时间与此 shell 脚本中的开始时间相同?

linux - 为列表中的每个项目执行 bash 脚本

php - Laravel Command 输出的 Node 版本与命令行不同

c - 奇怪的内存行为处理 TSV

linux - nohup 错误没有那个文件或目录

linux - 使用输入列表备份的 Shell 脚本

linux - 检查程序是否已死亡

python - 无法在 Vagrant 中使用 Virtualenv 导入模块

linux - "How To"用于向 Nagios 添加插件

用于运行交互式 shell 的 java Runtime.exec 挂起