如何结合多 bash 参数扩展

how to combine multi bash parameter expansion

bash 参数扩展有一些有用的功能,例如子串,替换,上,下。如何在不定义临时参数的情况下组合这些功能?

f="abc.txt"
e=${f:4:3}   #txt
echo ${e^^}  #TXT

我把e定义到txt上面。 echo ${${f:4:3}^^} 无法工作。是否可以省略 e。如果 java 我可以写

String f="abc.txt";
System.out.print(f.substring(4,7).toUpperCase());

甚至,我可以

System.out.print("abc.txt".substring(4,7).toUpperCase());

不,这在 bash AFAIK 中是不可能的。

当指定超过 1 个参数扩展时,我们需要某种优先级排序(以及解析逻辑更改),目前尚无相关代码。