Bash script to count arguments in 'uptime' command linux

Hi Experts,

I am trying to write a script that determines if the word 'days' is present in the output from the 'uptime' command.

I am very new to scripting and cannot find a way to do it.

Thanks in advance.
madstylexAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
woolmilkporcConnect With a Mentor Commented:
if uptime | grep -q "days"; then
    echo "'days' present in the output from 'uptime'"
         else
             echo "'days' NOT present in the output from 'uptime'"
fi
0
All Courses

From novice to tech pro — start learning today.