0

What are the commands needed to run a script showing warning banners have been created with if else statement?

Eg:

If [something == something]
   echo " Banners created"
else
   echo "Banners not created"
   echo " Details: "
   echo $( /bin/ls -l /etc/motd)
Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
DawnBelly
  • 11
  • 1
  • 3

1 Answers1

1
if grep -q 'mywarning' /etc/motd; then
    echo " Banners created"
else echo "Banners not created"
    echo " Details: $(/bin/ls -l /etc/motd)"
fi
jordanm
  • 41,988
  • 9
  • 116
  • 113
Hauke Laging
  • 88,146
  • 18
  • 125
  • 174