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 6096475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:55:54+00:00 2026-05-23T12:55:54+00:00

I have need to execute a command in a script an arbitrary number of

  • 0

I have need to execute a command in a script an arbitrary number of times with associated arbitrary parameters.

I’ve decided the script will take its cue from a parameter file (parameter.txt) where lines are of the form:

label param1 param2

For each line in parameter.txt, I’ll call the command with the specified parameters.

So far, my tinkering is moving along the lines of the following, but it’s looking messy:

while read line; do 
    echo $line | sed -r 's/[^ ]+ ([^ ]+).+/\1/' && 
        echo $line | sed -r 's/[^ ]+ [^ ]+ ([^ ]+)/\1/'
done < parameter.txt

My command is of the form:

mycmd -a param1 -b param2 > label

Could I get some suggestions how I might simplify this?

I’m doing this for a small embedded system whose ‘helper’ commands are in short supply (xargs for example isn’t available, and things like awk are hobbled busybox implementations), and I’m using version 2 (2.04g I think) of BASH.

  • 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-23T12:55:54+00:00Added an answer on May 23, 2026 at 12:55 pm
    while read label param1 param2; do
        mycmd -a "$param1" -b "$param2" > "$label"
    done < parameter.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to have a script execute (bash or perl or php, any will
I need to execute MDX query from command line (MS AS 2005). I have
I have any number of anchor links on a page that need to execute
I need to execute a command 100-200 times, and so far my research indicates
i have to parse need string. Here is command I execute in Linux console:
I have need to select a number of 'master' rows from a table, also
I would like to execute a MySQL command in a shell script/cron job that
I am working on a bash script where I need to conditionally execute some
I have an HTML textbox that contains some SQL code that I need executed.
We have need for a rating system in a project we are working on,

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.