0

I am using below command and it works:

uuencode stats.txt stats.txt | mailx -s "users" info@whale.de

But when I put same command inside my shell script, it does not work.

I dont have email. I am using ksh. Can anyone tell me why it fails?

Solution: There was no error and no email sent either. When I used set -x for debug nothing was returned either for debug.

I moved the uuencode section out the function section in the script to a separate section. And it worked; the debug returned message and I got email

Drsin
  • 1
  • Hi Drsin, it will be helpful if you post the error-messages your script prints. You can set -x in the first line of your script to help with debugging. – markgraf Feb 02 '23 at 10:25
  • Thanks @markgraf. I removed the uuencode from the function within the script. It works now within its own section inside same script. The set -x was helpful to debug. – Drsin Feb 02 '23 at 10:57
  • 1
  • 1
    @roaima It would still be somewhat interesting to understand why it worked standalone on the command-line though ... – AdminBee Feb 03 '23 at 10:13
  • 1
    @AdminBee having used uuencode myself in years gone by (doesn't that make me feel old!) I can't see anything wrong with the single line snippet posted here. We'd need to see permissions on stats.txt and have an explanation of "it does not work" - for example, does uuencode not produce output, or does the mailx generate an error, or ...? – Chris Davies Feb 03 '23 at 11:02
  • Please edit your question to include the previous errors. And then answer your question with how you fixed it. Don't be DenverCoder9, please, that's a very bad habit. See https://xkcd.com/979/ – markgraf Feb 03 '23 at 11:48

0 Answers0