- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- testing a file then emailing it ..
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 11:56 AM
07-10-2001 11:56 AM
If no data in it .. not to email it.
I tried test -s filename
but it didnt work.
Thanks
Richard
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 12:02 PM
07-10-2001 12:02 PM
SolutionYour test -s filename should have been fine.
Did it look something like this:
if [ -s filename ]
then
echo "Non-zero filesize"
else
echo "Empty File; skipping"
fi
If by no data then you mean if all I see are blanks or LF's or CR's, that's a bit different.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 12:02 PM
07-10-2001 12:02 PM
Re: testing a file then emailing it ..
if [ -s $file ]
then
#email me
else
#file is empty don't email
fi
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 12:15 PM
07-10-2001 12:15 PM
Re: testing a file then emailing it ..
This works. Compose an empty file, try this, and then echo something to it with redirection:
if [ -s /tmp/myfile ]
then
echo "file has data"
else
echo "file is empty!"
fi
You could also do:
if (( `wc -c < /tmp/me` > 0 ))
then
echo "there is data!"
else
echo "this file is empty"
fi
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 12:25 PM
07-10-2001 12:25 PM
Re: testing a file then emailing it ..
-s should work....
You can also do like this:
siz1=`wc -l myfile`
if [ $siz1 -eq 0 ]
then
#dont mail
else
fi
This will work definitely....
Cheers...
Satish.