Posts Bash Directory Exists?
Post
Cancel

Bash Directory Exists?

Directory Exists?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ cat directory_ex.sh 
#!/bin/bash
test_dir_exist(){
    set -e 
    if [ -e "/home/jayleekr/workspace/00_codes/05_info_archive" ];then
        echo "DIR Exist"
        exit 1

    fi
}
test_fail(){
    echo "test_fail"
}
test_dir_exist
1
2
$ ./directory_ex.sh
DIR Exist

Appendix. References

This post is licensed under CC BY 4.0 by the author.