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.
我在 ksh (Solris SunOS 5.10)
我有一个变量 $VAR 并想编写一个 if 仅当变量与格式 dd.mm.yyyy 匹配时才运行代码
例如 01.01.2009、05.12.1998 等。
我怎样才能做到这一点?
if [[ "${VAR}" == [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][0-9][0-9] ]]; then echo "Variable matches format dd.mm.yyyy" fi