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

  • Home
  • SEARCH
  • 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 9124515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:35:20+00:00 2026-06-17T06:35:20+00:00

I am looking for a script that will execute all of the bash scripts

  • 0

I am looking for a script that will execute all of the bash scripts in a given directory in the order by which they were added. For example, the earliest scripts added to the directory would be executed first.

This is what I am using now, but it doesn’t seem to execute the scripts by date added.

for each in /dir/*.sh; 
do 
    bash $each > /dev/null 2>&1 ; 
    rm $each > /dev/null 2>&1 ; 
done ;

Let me know how could modify this to order the files in the directory by date added.

  • 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-06-17T06:35:21+00:00Added an answer on June 17, 2026 at 6:35 am

    If you mean “in order of creation”:

    ls -ctr /dir/*.sh | while read script
    do
      bash $script > /dev/null 2>&1
      rm $script > /dev/null 2>&1
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I looking for a script that will enable me to select an area in
Im looking for a script that will take OData feed and download some .wmv
I'm looking for a script that will generate jpg thumbnails on the fly (in
I'm looking for a very simple script that will tell me if one twitter
I am looking for an MSBuild task/script that will allow me to control the
I'm looking for a simple C# script that will export an SVN folder. note:
I'm looking for a jQuery plugin or a standalone script that will take a
I'm currently looking at spawning 50+ PHP worker script instances that will be mostly
I'm trying to write a shell script that will execute a Hadoop MapReduce job
I am writing a bash script that I plan to execute via cron. In

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.