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.
我需要从 Linux“日期”命令中提取分钟值。在线指南确实令人困惑。你能帮忙吗?
听起来你想要:
date +%M
这将只打印分钟值,您可以将其分配给一个变量:
dat=`date +%M` echo $dat
你可以试试
为了直接得到它。
或这个
date | awk '{print $4}' | cut -d ":" -f 2
间接获得它