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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:11:28+00:00 2026-06-01T17:11:28+00:00

Is there a way to directly pass parameters to a .pbs script before submitting

  • 0

Is there a way to directly pass parameters to a .pbs script before submitting a job? I need to loop over a list of files indicated by different numbers and apply a script to analyze each file.

The best I’ve been able to come up with is the following:

#!/bin/sh 

for ((i= 1; i<= 10; i++))
do
        export FILENUM=$i
        qsub pass_test.pbs
done

where pass_test.pbs is the following script:

#!/bin/sh

#PBS -V
#PBS -S /bin/sh
#PBS -N pass_test
#PBS -l nodes=1:ppn=1,walltime=00:02:00
#PBS -M XXXXXX@XXX.edu

cd /scratch/XXXXXX/pass_test

./run_test $FILENUM

But this feels a bit wonky. Particularly, I want to avoid having to create an environment variable to handle this.

  • 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-01T17:11:29+00:00Added an answer on June 1, 2026 at 5:11 pm

    The qsub utility can read the script from the standard input, so by using a here document you can create scripts on the fly, dynamically:

    #!/bin/sh
    
    for i in `seq 1 10`
    do
        cat <<EOS | qsub -
    #!/bin/sh
    
    #PBS -V
    #PBS -S /bin/sh
    #PBS -N pass_test
    #PBS -l nodes=1:ppn=1,walltime=00:02:00
    #PBS -M XXXXXX@XXX.edu
    
    cd /scratch/XXXXXX/pass_test
    
    ./run_test $i
    EOS
    done
    

    Personally, I would use a more compact version:

    #!/bin/sh
    
    for i in `seq 1 10`
    do
        cat <<EOS | qsub -V -S /bin/sh -N pass_test -l nodes=1:ppn=1,walltime=00:02:00 -M XXXXXX@XXX.edu -
    cd /scratch/XXXXXX/pass_test
    ./run_test $i
    EOS
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to directly pass a variable number of arguments from one
Is there a way to directly read a binary file into RAM? What I
Is there a way to directly write result returned from TSQL / stored procedure
Is there any way to directly access a field of class in the aspx
Is there a way to use records directly in erl? No matter what I
Is there a way to complie code directly into Native Code instead of MSIL
Is there a way to attach metadata directly to a grouping element () in
Is there a way to checkout a file directly into a specific pending changelist
Is there any way to get RoleId without get directly from DB?, I know
Is there any way to render ASP.net MVC controls or code directly within a

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.