- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell Scripting Help...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 02:31 AM
05-04-2004 02:31 AM
I'm writing a script were the user can add a parameter when executing the script with an e-mail list. I get the information and I end up with a list similar to the list below in a variable called $EMAIL.
magnus,heath,mark
I've been playing with awk to extract the data and send an e-mail to each person. My problem in doing that is that I don't know the length of the list.
Does anyone have any ideas of how to accomplish this?
Thanks,
Magnus
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 02:36 AM
05-04-2004 02:36 AM
Re: Shell Scripting Help...
there is a NF variable with the number of fields in a record. And a FS variable where you can change the default field separator from "space" to ",".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 02:42 AM
05-04-2004 02:42 AM
SolutionIFS=",
"
VARIABLE="magnus,heath,mark"
for NAME in $VARIABLE
do
mailx -s "Your mail sir/madam" $NAME
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 02:42 AM
05-04-2004 02:42 AM
Re: Shell Scripting Help...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 02:42 AM
05-04-2004 02:42 AM
Re: Shell Scripting Help...
#!/usr/bin/sh
IFS=","
list="magnus,heath,mark"
for $user in $list ; do
mailx -s "from a shell" $user@company.con
Variable IFS is used to specify the parameter seperator character (in this case you are using comma).
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 02:42 AM
05-04-2004 02:42 AM
Re: Shell Scripting Help...
# perl -e'qx"mailx -s Test $_
given that the content of the mail is in the file content.txt
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 02:46 AM
05-04-2004 02:46 AM
Re: Shell Scripting Help...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 03:10 AM
05-04-2004 03:10 AM
Re: Shell Scripting Help...
with Mark's solution you would have to write the mails yourself, did it hang?
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 03:13 AM
05-04-2004 03:13 AM
Re: Shell Scripting Help...
Here is the code I ended up using for the e-mail function. It does not Hang. I've just tested it successfully.
# Function send_email_paging
send_email_paging(){
if [ "${PAGING_NOTIFY}" = 1 ]
then
if [ "${EMAIL_NOTIFY}" = 1 ]
then
echo "Pages is being sent to " $PAGING | tee -a $LOGFILE
IFS=","
for NAME in $PAGING
do
echo "cpscript.log has been sent to your e-mail" | mailx -s "cpsript" $NAME
done
IFS=" "
fi
if [ "${EMAIL_NOTIFY}" = 0 ]
then
echo "Pages is being sent to " $PAGING | tee -a $LOGFILE
IFS=","
for NAME in $PAGING
do
echo "Review cpscript.log on " `hostname` | mailx -s "cpscript" $NAME
done
IFS=" "
fi
fi
if [ "${EMAIL_NOTIFY}" = 1 ]
then
echo "Log file is being sent to " $EMAIL | tee -a $LOGFILE
IFS=","
for NAME in $EMAIL
do
mailx -s "cpscript.log" $NAME < $LOGFILE
done
IFS=" "
fi
}