In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
How Linux uses if to determine whether a directory exists
The methods are as follows:
1. The method of judging the existence of a directory by using if in the script
#! / bin/bashif [- d "c"]; then echo "directory c exists" else echo "directory does not exist" fi
2. Simple and convenient writing method
#! / bin/bash [- d "c"] & & echo "directory c exists" # or [- d "d"] | | echo "directory d does not exist"
More judgment formats are as follows:
-e filename true if filename exists
-d filename true if filename is a directory
-f filename true if filename is a regular file
-L filename true if filename is a symbolic link
-r filename true if filename is readable
-w filename true if filename is writable
-x filename true if filename is executable
-s filename true if the file length is not 0
-h filename true if the file is a soft link
So far, this is the end of this article on how Linux uses if to determine whether there are instances in a directory. For more information about how Linux uses if to determine whether a directory exists, please search for previous articles or continue to browse the relevant articles below. I hope you will support it in the future!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 221
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.