Example details the command link operator in Linux

  • 2020-10-31 22:05:13
  • OfStack

& & Cooperate with | |


eg:
cat test.sh 
#!/bin/bash
[ -e /etc/hosts ] && echo "ok" || echo "fail"
bash test.sh 
ok
eg:
cat test.sh 
#!/bin/bash
[ -e /etc/hostssssss ] && echo "ok" || echo "fail"
bash test.sh 
fail
 Note that there  &&  Must be in  ||  before 

Command merge operator {}


[ -f /home/tecmint/Downloads/xyz1.txt ] || {touch /home/tecmint/Downloads/xyz.txt; echo "The file does not exist"}
 " The file does not exist " 

conclusion


Related articles: