Linux—shell中$(( ))、$( )、``与${ }的区别

原文博客:https://blog.csdn.net/yangyang3_/article/details/80378733

此处大概记录
$()与` `(反引号)功能相同,用作命令替换
案例:$ echo today is $(date "+%Y-%m-%d")
today is 2014-07-01
``看着容易混乱,且复合替换需要反斜线处理,但是所有unix系统都支持,$()则不一定
${}是变量替换
案例:
file=/dir1/dir2/dir3/my.file.txt
${file:0:5},是提取最左边的 5 个字节,结果是:/dir1
$(( ))与整数运算

原文地址:https://www.cnblogs.com/tianphone/p/11103755.html