Description of OR AND Operator

From the below i would need the difference using between && and ||

 

error_func()
{
        # Standard error function
        [[ -n $* ]] && print -u2 "ERROR: $*"
        exit 1
}

 [[ -z ${TMPDIR} ]] && error_func "Source Directory is missing as input argument"
  [[ -d ${TMPDIR} ]] || error_func "Source Directory does not exists"

i would like to differnce between && ||

needed description

  1. mce, pudhukotai, india

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

It checks the return status of the previous command. && runs the following command if it succeeds, || runs the following command if it fails. Working examples:

true && echo "this will print"
true || echo "this will not"
false && echo "this won't print"
false || echo "but this will"
2 Likes