$ time if [[ $dir2 -ot $dir1 ]] ; then open $dir2 ; else open $dir1 ; fi real 0m0.055s user 0m0.023s sys 0m0.018s $ time [[ $dir2 -ot $dir1 ]] && open $dir2 || open $dir1 real 0m0.000s user 0m0.000s sys 0m0.000s
At above, I compared two methods for testing which directory is older and then opening the older directory. I guess I'm just confused why the
|| operators right after a test has the same functionality of an
then test, and why it's faster. Are there advantages/disadvantages to each?