How to use if in Linux to determine whether a directory exists Here’s how: 1. How to use if in the script to determine whether a directory exists #!/bin/bash if [ -d "c" ];then echo "directory c exists" else echo "directory does not exist" fi 2. Simple writing #!/bin/bash [ -d "c" ] && echo "Directory c exists" # or [ -d "d" ] || echo "Directory d does not exist" More judgment formats are as follows:
This concludes this article on how to use if in Linux to determine whether a directory exists. For more information on how to use if in Linux to determine whether a directory exists, please search for previous articles on 123WORDPRESS.COM or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Several common methods of sending requests using axios in React
>>: Detailed explanation of how to connect Java to Mysql version 8.0.18
This article takes Centos7.6 system and Oracle11g...
Table of contents 8. CSS3 click button circular p...
System environment: Win10 64-bit MySQL version: m...
Background-image is probably one of those CSS pro...
Common scenarios for Nginx forwarding socket port...
Before introducing the GROUP BY and HAVING clause...
Preface To modify file permissions in the termina...
Overlay network analysis Built-in cross-host netw...
Table of contents Preface text parameter example ...
Table of contents Requirements encountered in act...
1. Tools We need two tools now: MySQL server (mys...
Table of contents 1. Create a table 1.1 Create te...
1. Block-level element: refers to the ability to e...
Preface The reason for writing this article is mai...
Anyone who has worked on a large system knows tha...