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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:50:14+00:00 2026-05-19T02:50:14+00:00

I knew how to write that bash once, but I can’t figure it out

  • 0

I knew how to write that bash once, but I can’t figure it out anymore.

As the title says, it should be script aimed at running on a Linux server.

My goal is to do those commands without having it typed again and again.
(I’m chaining the input files in each run.)

bsprun -npes 1 ./a.out file1.txt file2.txt
bsprun -npes 2 ./a.out file1.txt file2.txt
bsprun -npes 3 ./a.out file1.txt file2.txt
bsprun -npes 4 ./a.out file1.txt file2.txt
bsprun -npes 5 ./a.out file1.txt file2.txt
bsprun -npes 6 ./a.out file1.txt file2.txt
bsprun -npes 7 ./a.out file1.txt file2.txt
bsprun -npes 8 ./a.out file1.txt file2.txt
  • 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-19T02:50:15+00:00Added an answer on May 19, 2026 at 2:50 am

    Actually, after reading your description a bit more closely, perhaps you want this:

    #!/bin/bash
    
    bsprun -npes "$1" ./a.out "$2" "$3"
    

    chmod +x the script then call it like

    ./myscript 1 file1.txt file2.txt
    ./myscript 2 file2.txt file3.txt
    ./myscript 3 file4.txt file5.txt
    ...
    

    If your input files change according to a pattern we could make the script a bit smarter but it is unclear what your file names look like.

    To get the exact output you posted, put it in a loop like:

    #!/bin/bash
    
    for i in {1..8}; do
      bsprun -npes $i ./a.out file1.txt file2.txt
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I knew ActionScript and ActionScript2 inside out, but I've been away from Flash for
I knew of some performance reasons back in the SQL 7 days, but do
I knew I should never have started using c++ io, the whole type safety
I knew there is a JQuery form validation, but if there is no form,
I once knew a website where the user could generate the little W3C valid
Is there a way to write the PHP file_exists function so that it searches
I'm trying to write a tool that will take as input some C code
I am trying to write a function that takes as arguments the name of
Long before I knew anything - not that I know much even now -
I'm trying to write a unit test for a class that generates distinct strings.

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.