The Problem:

I wanted to send myself a listing of files in a directory from a remote
machine.

How I solved it:
$ ls -l /path/foo > bar
$ mail -s"listing of /path/foo" [EMAIL PROTECTED] < bar

How I tried to solve it:
$ mail -s"bleh" [EMAIL PROTECTED] < `ls -l /path/foo`
does not work because '`' causes the shell to use the output as a list of
files
$ mail -s"bleh" [EMAIL PROTECTED] < eval "ls -l /path/foo"
does not work because eval is evaluated as a filename which does not exist
$ ls -l /path/foo | mail -s"bleh"...
does not work because mail can't be the target of a pipe

more exotic variants:
$ mail -s"blah" [EMAIL PROTECTED] < (ls -l /path/foo)
unexpected token '('
$ mail -s"blah" [EMAIL PROTECTED] < $(ls -l /path/foo)
no such file

What I'm seeking:
the bit of syntax that will let me use the output of a command
as the input to mail obviously, but more generally
$ command1 < ?command2?

I was trying this using /bin/sh on OpenBSD but a good solution would work
on most POSIX'ly compliant shells.

Suggestions?


http://www.efn.org/~laprice        ( Community, Cooperation, Consensus
http://www.opn.org                 ( Openness to serendipity, make mistakes
http://www.efn.org/~laprice/poems  ( but learn from them.(carpe fructus ludi)

Reply via email to