below is the code which I am working on, I am trying to trigger the mail when it enters the if block
#!/bin/bash
toaddr2="[email protected]"
# Main Routine
export PATH=/usr/bin:/usr/local/bin
ssh -o PasswordAuthentication=no -q [email protected] exit
test=$?
echo "return value is $test"
set PATH=/usr/bin:$PATH
mail $toaddr2 -s "THIS IS THE SUBJECT"
When I execute the above code, i am getting mail command not found I am using bash and tried setting up the path as well.
I tried with mailx command as well, got the same error Not worked, any clue from any one, what might be the issue.
You can start with:
which mail
If it is in your path you can have the full path to it in bash. You could also attempt to use
locate
To find mail on your machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With