Monday, 9 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  Linux filesystems: Ext4, Btrfs, XFS, ZFS and more

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

Cologix expands AWS direct connect footprint at its edge data center in Canada

Cologix, an information middle firm in North America, has introduced the provision of a brand…

March 4, 2024

iGaming Companies Have Been Sold For More Than £100 Billion 

Bojoko.com, a UK-focused affiliate web site, has created a brand new database designed to observe…

February 15, 2024

Polkadot and SP Negócios Collaborate to Enhance Crypto Economy Development

Campinas, Brazil, November fifth, 2024, Chainwire SP Negócios, São Paulo’s funding and export promotion company,…

November 5, 2024

Huawei open-source AI platform details revealed at Huawei Connect 2025

Open-source AI growth took centre stage at Huawei Join 2025 final week, with Huawei laying…

September 29, 2025

Hexaware Technologies to Expand Workforce by Up to 8,000 Globally in 2024

World expertise options supplier Hexaware Applied sciences has introduced a major workforce growth for 2024.…

July 4, 2024

You Might Also Like

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
Shutterstock Germany Only - News - Intel Factory Germany September 2024
Global Market

Intel sets sights on data center GPUs amid AI-driven infrastructure shifts

By saad
Side view of technician or engineer with headset and laptop standing in industrial factory.
Global Market

Is private 5G/6G important after all?

By saad
Levi’s Stadium hosts Super Bowl LX
Global Market

Super Bowl LX raises network expectations

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.