May 01, 2008
Emailing yourself the result of a query
echo "select 1 from dual;" | sqlplus user/password@database | mail -s "Result of your query" simon@brunningonline.net

I love Unix, me.

Posted to Linux by Simon Brunning at May 01, 2008 02:06 PM
Comments

By gad I think he's got it!

Congratulations on appreciating the value of the unix pipe. I love them too, although my attentions have wandered a bit recently and I should spend more time at the command prompt.

Posted by: Andy Todd on May 2, 2008 03:32 AM

I really miss the ability to do things like this when I'm working in a Windows environment. Just yesterday, however, I got all excited when I realised that I can improve the usefulness of Window's command-line a small amount

Even before using pipes, it annoys me that executables are rarely on the path, unless I take the time to append every newly-installed program's directory to the %PATH% environment variable, which is a pain, and also results in a PATH with a thousand entries on it, which are ostensibly searched every time I type a command. Ugly.

It would be better if I could (unix stylee) add a single personal directory to the path (I use %HOME%/bin, for example) and then put shortcuts to my binaries in that directory. I'm using shortcuts, since links only work on Vista, unless someone can enlighten me otherwise)

The problem with that is, shortcuts all have an invisible '.lnk' extension added to the filename. LNK files are not executable. So I can't type in the shortcut name to run the progam. Sigh.

Yesterday's insight was a belated realisation that I can add the link file's extension to the PATH_EXT environment variable, which lists the extensions of executable files (eg. .EXE;.BAT; etc):

PATH_EXT=%PATH_EXT%;.LNK

Or, better still:

PATH_EXT=%PATH_EXT%;.LNK;.EXE.LNK

Now I can type 'firefox.exe' or just 'firefox' and it actually runs the executable. Imagine that. Welcome to the 21st century.

Next up: A quick script to search for executables and Start menu links, and produce shortcuts to them in the personal bin directory. Then I can type any executable name and have it just work. Scripts need not know about the install directory of a program - they can just invoke them by name.

There are a couple of problems around what to do with identically named executables, but for me I think I'd rather work around this wrinkle than put up with the previous state of affairs.

Posted by: Jonathan Hartley on May 3, 2008 01:08 PM
Post a comment
Name:


Email Address:


URL:



Comments:


Remember info?