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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:41:24+00:00 2026-05-30T07:41:24+00:00

I am using mount -o bind /some/directory/here /foo/bar I want to check /foo/bar though

  • 0

I am using

mount -o bind /some/directory/here /foo/bar

I want to check /foo/bar though with a bash script, and see if its been mounted? If not, then call the above mount command, else do something else. How can I do this?

CentOS is the operating system.

  • 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-30T07:41:25+00:00Added an answer on May 30, 2026 at 7:41 am

    Running the mount command without arguments will tell you the current mounts. From a shell script, you can check for the mount point with grep and an if-statement:

    if mount | grep /mnt/md0 > /dev/null; then
        echo "yay"
    else
        echo "nay"
    fi
    

    In my example, the if-statement is checking the exit code of grep, which indicates if there was a match. Since I don’t want the output to be displayed when there is a match, I’m redirecting it to /dev/null.

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

Sidebar

Related Questions

I want to mount a remote directory using sshfs. sshfs working fine from terminal.
Is it possible to mount a local directory into another one? Using Perforce, I
I need to mount a directory dir on a network machine data using python
Hi I am trying to mount as a drive in vista I am using
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using a hex-editor to mount a NTFS volume, I've found an offset within the
I would like to mount a trucrypt volume using PHP, but I'm getting the
I am trying to create an SQLite DB using BlackBerry IDE. First I mount
I have a simple script which copies a file from one SMB mount to
I would like to Mount a Folder as a Letter using Windows XP. E.g.

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.