Tuesday, 10 Feb 2026
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  5 ways cloud computing is transforming healthcare

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

Digital Realty and Süwag Energie AG sign renewable energy agreement

Under the terms of the agreement, Digital Realty has secured Guarantees of Origin (GoOs) for…

January 22, 2024

Microsoft says Delta ignored Satya Nadella’s offer of CrowdStrike help

Microsoft has responded to Delta Air Strains’ criticism of Home windows and CrowdStrike after the…

August 7, 2024

Crusoe, Redwood Partner on Data Center Powered by Used Batteries

(Bloomberg) -- Redwood Supplies launched what it says is the most important deployment of reused batteries…

July 13, 2025

Samsung, SK Hynix Ink Deal to Supply Gear to Stargate

(Bloomberg) -- Samsung Electronics Firm and SK Hynix Firm have cast preliminary agreements to provide…

October 1, 2025

Lumen Powers Kentucky Derby with Network-as-a-Service

In anticipation of the 151st Kentucky Derby, Churchill Downs Racetrack has partnered with Lumen Applied…

April 27, 2025

You Might Also Like

Hacker aus China
Global Market

DKnife targets network gateways in long running AitM campaign

By saad
RAM memory stick module exposed and sitting on a circuit board
Global Market

Intel teams with SoftBank to develop new memory type

By saad
Can air cooling survive the AI era?
Global Market

Can air cooling survive the AI era?

By saad
System administrator typing supercomputer hub disaster recovery plan on laptop to provide fast restoration of service, limiting damage and minimizing interruptions to normal operations
Global Market

8 hot networking trends for 2026

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.