The method of judging the existence of a file or directory by linux through if statement
Catalog judgment:
Path= "/ home" # if [!-d ${path}]; then if [- d ${path}]; then echo dir ${path} exist! Else echo dir ${path} not exist! Fi
Document judgment:
File= "/ home/log.txt" if [- f ${file}]; then echo file ${file} exist! Else echo file ${file} not exist! Fi
These are the details of how to determine the existence of a file or directory through if statements in linux. Please pay more attention to other related articles!