- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: script
Operating System - Linux
1752666
Members
5720
Online
108788
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО01-02-2011 09:11 PM
тАО01-02-2011 09:11 PM
Hi there
I have a file with a bunch of e-mail addresses in it.
How do I display (or perform any other task) each and every e-mail address from this file ?
EMAIL=`cat eaccounts`
for ARG in "$EMAIL"
do
echo $ARG
done
Unfortunately the above method will print a list of e-mail addresses instead of one per time. Which proves that there is only one ARG which looks something lie this: user1@dom.com user2@dom.com user3@dom.com etc.
How do I make the script know there are multiple addresses in this file please ?
Regards
Peter
I have a file with a bunch of e-mail addresses in it.
How do I display (or perform any other task) each and every e-mail address from this file ?
EMAIL=`cat eaccounts`
for ARG in "$EMAIL"
do
echo $ARG
done
Unfortunately the above method will print a list of e-mail addresses instead of one per time. Which proves that there is only one ARG which looks something lie this: user1@dom.com user2@dom.com user3@dom.com etc.
How do I make the script know there are multiple addresses in this file please ?
Regards
Peter
Jesus is the King
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2011 09:47 PM
тАО01-02-2011 09:47 PM
Solution
> I have a file [...]
On what?
uname -a
It's nice that at least one of us can see
what's in that file. It might be nicer if
_more_ than one of us could see what's in
that file.
> for ARG in "$EMAIL"
Did you try anything like, say:
for ARG in $EMAIL
?
If the items in the file are arranged one per
line, like, say:
$ cat em.dat
line 1
line 2
line 3
then a while-read loop could be used:
$ cat em.sh
#!/bin/sh
(
while read line ; do
echo "$line"
done
) < em.dat
$ ./em.sh
line 1
line 2
line 3
On what?
uname -a
It's nice that at least one of us can see
what's in that file. It might be nicer if
_more_ than one of us could see what's in
that file.
> for ARG in "$EMAIL"
Did you try anything like, say:
for ARG in $EMAIL
?
If the items in the file are arranged one per
line, like, say:
$ cat em.dat
line 1
line 2
line 3
then a while-read loop could be used:
$ cat em.sh
#!/bin/sh
(
while read line ; do
echo "$line"
done
) < em.dat
$ ./em.sh
line 1
line 2
line 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 08:56 AM
тАО01-03-2011 08:56 AM
Re: script
#!/bin/sh
(
while read line ; do
echo "$line"
done
) < em.dat
Worked for me.
Thanks
(
while read line ; do
echo "$line"
done
) < em.dat
Worked for me.
Thanks
Jesus is the King
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 12:15 PM
тАО01-03-2011 12:15 PM
Re: script
>while read line; do ... Worked for me.
And so would Steven's first suggestion of removing those quotes:
for ARG in $(< eaccounts); do
echo $ARG
done
And so would Steven's first suggestion of removing those quotes:
for ARG in $(< eaccounts); do
echo $ARG
done
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP