0

I am using below command and it works:

uuencode stats.txt stats.txt | mailx -s "users" [email protected]

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

6
  • 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
    CommentedFeb 2, 2023 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
    CommentedFeb 2, 2023 at 10:57
  • 1
    Does this answer your question? how to send multiple attachment in 1 email using uuencodeCommentedFeb 2, 2023 at 18:15
  • 1
    @roaima It would still be somewhat interesting to understand why it worked standalone on the command-line though ...
    – AdminBee
    CommentedFeb 3, 2023 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 ...?CommentedFeb 3, 2023 at 11:02

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.