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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:16:17+00:00 2026-05-16T18:16:17+00:00

I work in a research group and we use the PBS queuing system. I’m

  • 0

I work in a research group and we use the PBS queuing system. I’m no PBS master, but I wanted to script a search for if a job was running. To do this I first grab a string of all the jobs by using the results of a qstat call as my argument to qstat -f and then taking the detailed list of all jobs and searching it for the submitted file path. The current kludge stands as follows

dump=`qstat -f `qstat``
if grep -q \
          "/${compounds[$i]}/D0_${j}_z_$((k*30))/scripts/jobscript_minim" \
      <<<$dump; then
      echo "Minimize is running!"
fi

Suggestions for improvement?

Also, I’ve been told that $() is cleaner than “. But when I try:

dump="$(qstat -f "$(qstat)")"

…my program fails. Why is this? Am I misunderstanding how to nest shell calls with $()?? Or is it something to do with how I’m passing the list of queue jobs from qstat to qstat -f? Should I be using awk or something to grab the jobs from the qstat command and then somehow pass them as args to qstat -f?

Also should I be using recursive grep? Some people tell me its “saner” but I’m not sure what that means. Is it more portable? Is it faster? Does it need less trips to the therapist?

What is the reason you should use it?

  • 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-16T18:16:18+00:00Added an answer on May 16, 2026 at 6:16 pm

    Alright… managed to come up with a clean solution…

    search_dir="${compounds[${i}]}/D0_${j}_z_$[30*k]"
    if [ ! -z "$(qstat -f $(qstat | grep -F jmick | awk '{print $1}')|\
          grep -F "$search_dir"|head -n 1)" ]
          then
    

    …since the directory I’m searching for is kind of long I assign it to a variable. I run the inner command substitution to get only the jobs with my user name, then run the outer command substitution to print full details on those jobs and then grep through those details for my directory. In case it finds it early I included a head to try to short circuit the command.

    The question of what’s the point of recursive grep, though, still stands.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work in a group that does a large mix of research development and
work on asp.net vs 05 C#.Master page header contain the bellow code <script type=text/javascript
I'm working in research and my bioinformatics work group needs a project management software
At my work we are running a group of tests that consist of about
So for some research work, I need to analyze a ton of raw movement
I work for a market research company in the online space. We have been
I work as support staff in a biology research institute as a student, and
After a quick research here and here , the solutions didn't work for my
I am conducting a research on type systems. For this work I am investigating
I am currently on a short research project. The company I work at has

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.