Saturday, 13 Dec 2025
Subscribe
logo
  • Global
  • AI
  • Cloud Computing
  • Edge Computing
  • Security
  • Investment
  • Sustainability
  • More
    • Colocation
    • Quantum Computing
    • Regulation & Policy
    • Infrastructure
    • Power & Cooling
    • Design
    • Innovations
    • Blog
Font ResizerAa
Data Center NewsData Center News
Search
  • Global
  • AI
  • Cloud Computing
  • Edge Computing
  • Security
  • Investment
  • Sustainability
  • More
    • Colocation
    • Quantum Computing
    • Regulation & Policy
    • Infrastructure
    • Power & Cooling
    • Design
    • Innovations
    • Blog
Have an existing account? Sign In
Follow US
© 2022 Foxiz News Network. Ruby Design Company. All Rights Reserved.
Data Center News > Blog > Global Market > Examining the many ways to run loops on Linux
Global Market

Examining the many ways to run loops on Linux

Last updated: September 28, 2024 7:44 am
Published September 28, 2024
Share
abstract background light blue
SHARE

You might use a loop like these proven beneath to run by the letters of the alphabet or a sequence of numbers.

$ for x in a..z
do
    echo $x
performed

$ for x in 1..11; do     echo $x; performed

The for command beneath would show calendars for the final three months of the present yr.

$ yr=`date +%Y`; for month in 10..12; do cal $month $yr;  performed

The script beneath loops by all of the months of the yr.

$ for month in `locale mon | sed 's/;/ /g'`; do   echo $month; performed
January
February
March
April
Might
June
July
August
September
October
November
December

Utilizing whereas loops

Whereas loops preserve looping so long as the situation that they’re set as much as monitor is true. Right here’s an instance:

#!/bin/bash

n=1

whereas [ $n -le 4 ]
do
    echo $n
    ((n++))
performed

The script above increments and shows the worth of $n so long as it’s lower than or equal to 4. You will get some time loop to run eternally (i.e., till the system crashes, you sign off, or somebody kills your script) utilizing “whereas true” as proven beneath. The sleep command ensures that it doesn’t run 1000’s of occasions earlier than you may have an opportunity to cease it.

#!/bin/bash

whereas true
do
    echo -n "Nonetheless operating at "
    date
    sleep 10
performed

The script beneath will run so long as the consumer who it’s ready for has not but logged into the system. This may be useful if you’re ready for a co-worker to deal with an issue earlier than you’ll be able to transfer forward along with your job. It checks as soon as a minute to see if the consumer has logged in but.

See also  Paula Cogan Resigns as euNetworks CEO, Kevin Dean Appointed Interim

Source link

TAGGED: Examining, Linux, loops, Run, Ways
Share This Article
Twitter Email Copy Link Print
Previous Article Grayscale Arc logo on pink and blue background. Arc browser adds security bulletins and bug bounties
Next Article Eaton opens new data centre power modules factory Eaton opens new data centre power modules factory
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Your Trusted Source for Accurate and Timely Updates!

Our commitment to accuracy, impartiality, and delivering breaking news as it happens has earned us the trust of a vast audience. Stay ahead with real-time updates on the latest events, trends.
FacebookLike
TwitterFollow
InstagramFollow
YoutubeSubscribe
LinkedInFollow
MediumFollow
- Advertisement -
Ad image

Popular Posts

Update your Windows PC to avoid a serious Wi-Fi vulnerability

Should you’ve been pushing aside your subsequent Home windows replace, now’s the time to put…

June 19, 2024

Devin 1.2: Updated AI engineer enhances coding with smarter in-context reasoning, voice integration

Be a part of our day by day and weekly newsletters for the newest updates…

January 18, 2025

A major data broker hack may have leaked precise location info for millions

Final week, main location information dealer Gravy Analytics disclosed a knowledge breach which will have…

January 13, 2025

Exelon shares lag after Maryland regulatory decision By Investing.com

On Thursday, Exelon Company (NASDAQ:) skilled a setback as its shares fell by 4%, underperforming…

June 13, 2024

Workgrounds Raises $2.6M in Funding

Workgrounds, a New York primarily based startup that automates the method of reserving and managing…

November 5, 2024

You Might Also Like

Data center / enterprise networking
Global Market

P4 programming: Redefining what’s possible in network infrastructure

By saad
Why data centre megadeals must prove their value
Global Market

Why data centre megadeals must prove their value

By saad
photo illustration of clouds in the shape of dollar signs above a city
Global Market

Cloud providers continue to push EU court to undo Broadcom-VMware merger

By saad
Kao SEED Fund awards £30,000 to Harlow community projects
Global Market

Kao SEED Fund awards £30,000 to Harlow community projects

By saad
Data Center News
Facebook Twitter Youtube Instagram Linkedin

About US

Data Center News: Stay informed on the pulse of data centers. Latest updates, tech trends, and industry insights—all in one place. Elevate your data infrastructure knowledge.

Top Categories
  • Global Market
  • Infrastructure
  • Innovations
  • Investments
Usefull Links
  • Home
  • Contact
  • Privacy Policy
  • Terms & Conditions

© 2024 – datacenternews.tech – All rights reserved

Welcome Back!

Sign in to your account

Lost your password?
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
You can revoke your consent any time using the Revoke consent button.