No Such file or directory.

Hello all,
I am trying to run below script for emailing an attachment. However, I receive the email without attachment.

Error:

/u04/oracle/devappl/xxwc/11.5.0/bin/excel_tut.pdf
: No such file or directory

My code:

#!/usr/bin/sh
#
# $5 - Email id
# $6 - Subject

echo "Email Test Started"
attfile=/u04/oracle/devappl/xxwc/11.5.0/bin/excel_tut.pdf
attfname=excel_tut.pdf
MESSAGE="Hi,
Please find attached the requested attachment.
Thanks."
(echo "$MESSAGE";uuencode ${attfile} ${attfname})|mailx -s "$6" $5
exit 0

What happens when you issue:

ls -la /u04/oracle/devappl/xxwc/11.5.0/bin/excel_tut.pdf

?

Make sure the file exists and you have at least permissions to read it.

The file exists and has full permissions

$ pwd
/u04/oracle/devappl/xxwc/11.5.0/bin
$ ls -la excel_tut.pdf
-rwxrwxrwx   1 appldev    dba         563363 Jun 21 10:40 excel_tut.pdf
/u04/oracle/devappl/xxwc/11.5.0/bin/excel_tut.pdf
: No such file or directory

This looks suspicious, like it thinks it has control characters on the end of the line which it's taking to be part of the filename. Did you edit this script in notepad?

1 Like

Thanks corona,
The problem was resolved once i used vi instead of pushing it from windows.
But the problem, uuencode is not attachhing the file instead it gives some wierd characters in message body.
Can anybody help in this issue.

just worth a try ...

I have already tried this