Skip to content

Latest commit

 

History

History
68 lines (54 loc) · 1.1 KB

Bash.md

File metadata and controls

68 lines (54 loc) · 1.1 KB

Logical operators

#programming #bash #operators

  • ;
    • you can run commands without creating a new line
echo "hello" ; echo "there"
# this is same as 
echo "hello"
echo "there"
  • && Operator
    • if the first command succeseded then run the second command
$ true && echo "Things went well"
Things went well

-|| Operator

  • if the first command failed then run the second command
$ false || echo "Oops, fail"
Oops, fail
  • & Operator
    • runs the first command and then immeadiatly runs the second command
$ sleep 5 & echo "all done" 
[1] 45034
all done 
# after 5 seconds
[1]  + 45034 done       sleep 5
sleep 5 ; echo "all done" 
# waits 5 seconds
all done
$ false || echo "Oops, fail"
Oops, fail

$ true || echo "Will not be printed"
$  

$ true && echo "Things went well"
Things went well

$ false && echo "Will not be printed"
$

$ false ; echo "This will always run"
This will always run

Find file in current directory recursively

#script

find . -type f -name "*.svg"