Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2001 16:00:24 -0700 (PDT)
From:      Linh Pham <lplist@closedsrc.org>
To:        BSD Freak <bsd-freak@mbox.com.au>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Shell scripting gurus I nedd your help
Message-ID:  <Pine.BSF.4.33.0107181557440.87495-100000@q.closedsrc.org>
In-Reply-To: <3320f53329d6.3329d63320f5@mbox.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2001-07-19, BSD Freak scribbled:

# Here's one for the shell scripting gurus:
#
# I have a file (admins.txt) with list of the e-mail addresses of my
# systems administrators (on per line) eg.
#
# john@ourcompnay.com
# fred@ourcompany.com
# betty@ourcompany.com
# ...
# ...etc
#
#
# I need to be able to e-mail them all the same message from the command
# line or a shell script (with only one command)
#
# For example I might need to email them the output of an "ls -al". I
# could:
#
# ls -al | mail -s "Ouput of ls command" john@ourcompnay.com
# ls -al | mail -s "Ouput of ls command" fred@ourcompnay.com
# ls -al | mail -s "Ouput of ls command" betty@ourcompnay.com
# ...
# .etc..
#
# how can I do this with only one command taking each persons e-mail
# address from the file admins.txt

If you reformatted the file (or use Perl) so that each name is separated
by a comma and a space, then you can do something like:

ls -al | mail -s "Output" `cat admins.txt`

Dunno if or how well it would work...

-- 
Linh Pham
[lplist@closedsrc.org]

// 404b - Brain not found


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.33.0107181557440.87495-100000>