Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7431333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:16:45+00:00 2026-05-29T09:16:45+00:00

I have a loop in my KornShell (ksh) script that I want to execute

  • 0

I have a loop in my KornShell (ksh) script that I want to execute at least once, and I want an elegant way of doing it, however while I have found plenty of stuff on how to write a while loop, there does not seem to be anything for a do…while loop out there.

What I am doing is reading in a comma-delimited list of files from a configuration file and processing them. If the list of files is empty, then I want to process all files in the directory.

What is a good way to do this?

EDIT: Here is what I have currently. I grab the filename, then remove it from the string for the next pass. If the list of Files is empty, I quit the loop. BUT, if the list is empty to begin with, I want it to still run once.

  while [[ -n "${FILES%%,*}" ]]; do
       FILE="${FILES%%,*}"                             
       FILES="${FILES#*,}"
  done
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:16:46+00:00Added an answer on May 29, 2026 at 9:16 am

    you could fake it:

    do_once=true
    while $do_once || [[ other condition ]]; do
      : your stuff here
    
      do_once=false
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have while loop and in that there's forum posts.I want to show number
I have a loop that looks something like this while(condition){ read_some_data(source, buf, BUFSIZE); printf(buf);
I have a loop that is doing some error checking in my PHP code.
I have a loop that reads each line in a file using getline() :
I have a loop on page to update an access database that takes 15-20
I have a loop that finds duplicate lines in a .ini file. I can
I have a loop that runs through a variety of websites and I'd like
I have a loop that runs for approx. 25 minutes i.e 1500 seconds. [100
I have a loop that is creating a drop down of 31 days. days
I have a loop here and I want to make it run faster. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.