you feed notavail.txt to uuencode and then feed uuencodes output too mailx. You do not see any email body because only the encoded content of your textfile arrives at mailx. For a mail body use something like this:
( cat notavail.txt ; uuencode notavailable.txt notavailable.txt ) | mailx -m -s "Files are not available" test@sample.com
Currently one problem i am facing is. the format looks different in unix end and format looks in different in notepad as well.currently the file is appending in the same line. could you please let me know if it is need to be appended in the next line what needs to be done.
current syntaxt:
echo "$i" >>available.txt
else
echo "$i" >>notavailable.txt
fi
Please let me know how to change the syntax to be appended in the new line.
---------- Post updated at 12:43 AM ---------- Previous update was at 12:29 AM ----------
in the unix side the format is like the lines are printing in the second line.
whereas in the attachment. it looks like all the lines are printed in the same line.
Expected output is in notepad it should like the lines are printed in the next line.
There are different line terminators in the unix and the windows world. To add the line endings windows editors understand there are 2 ways:
Create the text with the needed endings:
Convert the line endings: if the tool unix2dos is availabe it is the easiest and most self descriptive way. If it's not installed tools like sed can be used (there may be better/more elegant ways than below - you'll find lots of examples when you search this site):