shell programming problems (XVI)

topic:

Today the root user login how long

 

answer:

#!/bin/bash

cat /proc/uptime | awk -F . '{run_days=$1/86400; run_hour=($1%86400)/3600;run_minute=($1%3600)/60;run_second=$1%60; printf("the operation is already running %d days %d hours %d minute %d seconds\n", run_days, run_hour, run_minute, run_second)}'

 

operation result:

Guess you like

Origin www.cnblogs.com/wanghao-boke/p/12152209.html