AboutWelcome to Free Software Daily (FSD). FSD is a hub for news and articles by and for the free and open source community. FSD is a community driven site where members of the community submit and vote for the stories that they think are important and interesting to them. Click the "About" link to read more...
Swatch isn’t a cleverly designed watch from the 1980s but you’ll think it’s just as handy (and cleverly designed) as one. Like Logwatch, swatch is a perl script that watches your logs but swatch watches them for regular expressions that you configure. Swatch will notify you via mail or the console screen (stdout) when it matches the configured log file entries with your watchfor directives.
It's not often that I write about Perl Scripting on Unix Tutorial, but that's just because I don't script in Perl this much on a regular basis. Today, however, I'd like to share one of the building blocks - a really basic piece of functionality which you'll find really useful in almost any Perl script.
Many times while going through some perl code, you must have come across snippets like “select((select(fh), $|=1)[0])” and wondered what this means, even though you might know that: * $|=1 is used for setting autoflush (i.e. unbuffered data output) and that * select is used to set the default output to a given file handle instead of STDOUT
Perl and Bash ports of our newbie program to convert binary numbers to decimal. Code written for ease-of-reading, where possible. If you don't script already; start! :)
You can copy command line output to X Windows clipboard directly using xclip command. You can read from standard input (keyboard), or from one or more files, and makes the data available as an X selection for pasting into any X applications such as gedit, OpenOffice or Firefox / email client.