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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:49:19+00:00 2026-05-23T07:49:19+00:00

I have a path that is managed by update-alternatives. It seems this is confusing

  • 0

I have a path that is managed by update-alternatives. It seems this is confusing bash.

The following if should not print yes. But it does because bash thinks the directory does not exist – when in fact it does. This is all done as root, and I’ve tried the single bracket versions.

RUBY_ROOT=/usr/bin/ruby
CHK_DIR_PATH=`readlink -f "${RUBY_ROOT}"`
if [[ ! -d "${CHK_DIR_PATH}" ]] ; then echo yes; fi

The path does exist:

ls -la ${CHK_DIR_PATH}
-rwxr-xr-x 1 root root 6993617 2011-06-21 15:37 /usr/bin/ruby1.9.2-p180

Is there an alternative way to check if a directory does not exist?

  • 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-23T07:49:19+00:00Added an answer on May 23, 2026 at 7:49 am

    The path exists, but it’s not a directory; according to your ls -l, it’s a file. So test -d correctly returns false, whereas test -e and test -f would return true. I suspect you have something installed incorrectly.

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

Sidebar

Related Questions

It's not that I can't google for myself, however others have tread this path
We have an application that needs to know the path that it is executed
I have a variable in code that can have file path or url as
I have a path defined: when /the admin home\s?page/ /admin/ I have scenario that
In my live site I have php include() and require() that have full path
Using windows server, I have a path to a file that, when you click
I have a virtual path (example: ~/Images/Banner.jpg) and I want to make that an
I have a website that has a relative path to a stylesheet that looks
I have a mapping application that needs to draw a path, and then display
I have a custom installer action that updates the PATH environment, and creates an

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.