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.
假设我想检查第一个参数是否为 2 个字符长。我试过
if [ ${#$1} -e 2]
但它不起作用。
-eq
]
总而言之:
if [ ${#1} -eq 2 ] then echo "It's two characters long" fi