Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在扩展之前修改环境变量?
例子:
set ENV_VAR=some-stuff echo ${ENV_VAR} - get this to print "somestuff" instead of "some-stuff"
$ ENV_VAR=some-stuff $ echo ${ENV_VAR//[^a-zA-Z]} somestuff
参数扩展(这是您所谓的“大括号扩展”的正确术语,实际上完全是另外一回事)接受修饰符,例如使第一个字符(或所有字符)小写或大写,消除前缀或后缀, 并用其他字符串(或空字符串)替换模式。请参阅手册页中“扩展”部分中的“参数扩展” 。