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'm doing some research work into content aggregators, and I'm curious how some of
I have a blogengine.net install that requires privatization. I'm doing research work at the
I work with C# at work but dislike how with webforms it spews out
I work for a .NET/MSSQL shop that has trouble supporting customers running Novell, partially
At work we are currently still using JUnit 3 to run our tests. We
At work we are being asked to create XML files to pass data to
I work in VBA, and want to parse a string eg <PointN xsi:type='typens:PointN' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
At work, we have multiple branches that we may be working on at any
I work on a complex application where different teams work on their own modules
I work a lot with network and serial communications software, so it is often

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.