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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:56:36+00:00 2026-05-29T14:56:36+00:00

I am facing with the following bash script: #! /bin/bash processname=$1 x=1 while [

  • 0

I am facing with the following bash script:

#! /bin/bash
processname=$1
x=1
while [ $x -eq 1 ] ; do
    ps -el | grep $processname | awk ' {if($15!="grep") print "The memory consumed by the process " $15 " is = "$9}  ' >> out.log
    sleep 30
done

and I am running this with :

$ ./myscript.sh Firefox

but when i see the output in the file, apart from the firefox process i am also getting information for /bin/bash process

The memory consumed by the process /Applications/Firefox.app/Contents/MacOS/firefox is = 911328  
The memory consumed by the process /bin/bash is = 768

Can some one help me with this so that I only want to get information related to Firefox process and nothing else(/bin.bash etc)

  • 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-29T14:56:38+00:00Added an answer on May 29, 2026 at 2:56 pm

    This is normal and because the $processname is Firefox. Since your command also monitors it, there is a process that uses it.

    For example, try ps -el | grep Firefox and you will get two process lines matching (if you have one instance of Firefox running), one is Firefox, the other is the grep command looking for Firefox.

    Piping your output in grep -v /bin/bash' should solve this. Eg:

    ps -el | grep $processname | awk ...
    

    becomes:

    ps -el | grep $processname | grep -v 'grep' | awk ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a publicly facing website that does the following. Users log in.
I am facing a problem in a bash shell script. This script is supposed
I'm facing the following problem: in the controller I select the data I need
I am facing the following issue when deploying a com-exposed assembly to my client's.
I'm currently facing the following issue: My app dynamically creates images (320 x 480
I am learning facelets and Seam and I'm facing the following problem: I have
I am implementing a small database(university Project) and i am facing the following problem.
I have created a static library following this link . But I am facing
I am beginner for regular expression. so facing following problem. my code is as
I am facing the following situation. I use ajax to communicate with the backend

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.