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.
我有这个执行以下命令的 shell 脚本:
#!/bin/sh echo -e " {\"username\":\"user\",\"password\":\"mypasswd\",\"data\"" > $file
我需要如何调整它以测量执行时间并将执行时间和脚本输出回显到文件?
有小费吗?
使用time命令。例如:
time
time ( echo -e "$(date) \n--\n{\"username\":\"user\",\"password\":\"mypasswd\",\"data\": [$formated]}\n --" ) > $outputFileName 2>&1