Solved

Bash script  to count arguments in 'uptime' command linux

Posted on 2014-03-25
1
617 Views
Last Modified: 2014-03-25
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.
0
Comment
Question by:madstylex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39953347
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
database connection error mysql stops 7 82
Powershell Split 18 43
-OutVariable to Global 1 33
DB2 9.7 Grant Execute SP 4 60
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question