20

sh变量特性(2)-Linux菜鸟

 4 years ago
source link: http://blog.51cto.com/lythjq/2073516
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
变量设置方式说明示例${#变量}变量的长度A='Hello world!'echo ${#A}结果:12${变量:-word}如果变量为空或未定义,则变量展开为”word”;否则,展开为变量的值A='Hello world!'echo ${A:-OK}结果:Hello wold!unset A或 A=’’echo ${A:-OK}结果:OK${变量:+word}如果

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK