- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- <<EOF is not matched ?
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
10-30-2006 06:19 AM
10-30-2006 06:19 AM
mail -t $mailgroup <
From: $name
Cc: $dbgroup
this is the text
EOF
Solved! Go to Solution.
- Tags:
- here doc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 06:28 AM
10-30-2006 06:28 AM
Re: <<EOF is not matched ?
mail -t $mailgroup << EOF
Subject: $subjetc
From: $name
Cc: $dbgroup
this is the text
EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 06:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 06:32 AM
10-30-2006 06:32 AM
Re: <<EOF is not matched ?
case "$name" in
A)
mail -t $mailb <
From: $name
Cc: $dbagroup
text
EOF
;;
B)
etc etc etc
The error I get is actually Syntax error at line 18 : `<<' is not matched
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 06:45 AM
10-30-2006 06:45 AM
Re: <<EOF is not matched ?
#!/usr/bin/sh
THING=$1
case $THING in
A)
mail -t $mailgroup << EOF
Subject: $subjetc
From: $name
Cc: $dbgroup
this is the text
EOF
echo "A"
;;
B)
echo "B"
;;
esac
I invoked my script as './script.sh A' and it echoed A to the screen and I got the email.
Make absolutely SURE that you do NOT have any spaces before the last EOF. Putting ' EOF' after the mail text is the only way I've duplicated your problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 07:09 AM
10-30-2006 07:09 AM
Re: <<EOF is not matched ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 07:21 AM
10-30-2006 07:21 AM
Re: <<EOF is not matched ?
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 07:42 AM
10-30-2006 07:42 AM
Re: <<EOF is not matched ?
Just FYI, bash has the <<- redirection operator, which strips leading tabs from the here-document.
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 03:26 PM
10-30-2006 03:26 PM
Re: <<EOF is not matched ?
> removes extra spaces. [...]
Actually, it (they?) doesn't, but a
normal/typical Web browser does. "View
document source" (or whatever your browser
calls it), and the indentation is more
obvious. In this case, it all looked better
here than it must have in reality. (That is,
no obvious space before the terminating
"EOF".)