Explorar o código

Update main.sh

Anton Reutov %!s(int64=4) %!d(string=hai) anos
pai
achega
f41ad21e1e
Modificáronse 1 ficheiros con 14 adicións e 0 borrados
  1. 14 0
      func/main.sh

+ 14 - 0
func/main.sh

@@ -296,6 +296,20 @@ is_dir_symlink() {
     fi
 }
 
+# Check if file exists
+if_file_exists() {
+    if [[ -f "$1" ]]; then
+        check_result $E_FORBIDEN "$1 file exists"
+    fi
+}
+
+# Check if directory exists
+if_dir_exists() {
+    if [[ -d "$1" ]]; then
+        check_result $E_FORBIDEN "$1 directory exists"
+    fi
+}
+
 # Get object value
 get_object_value() {
     object=$(grep "$2='$3'" $USER_DATA/$1.conf)