Linux/ShellShell变量2021-05-20 21:24:20共95字 预计阅读1分钟${} 配合 # % 使用 1234567891011121314# # 去掉左边# % 去掉右边# 单符号为首匹配 双符号为尾匹配file=test.file.txt# 删掉第一个 . 及其左侧内容 file.txtecho ${file#*.}# 删掉最后一个 . 及其左侧内容 txtecho ${file##*.}# 删掉最后一个 . 及其右侧内容 test.fileecho ${file%.*}# 删掉第一个 . 及其右侧内容 testecho ${file%%.*}