Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 08-23-2005, 06:07 AM   #1
LQ Newbie
Registered: Aug 2005
Posts: 2

Rep: Reputation: 0
Question Shel script mail send ("/" in mail address) problem

Have to send mail using bash or sh (Suse 8.2 )

mail -s test -a text.txt test.try/ < empty.txt

test.try/ No such file or directory

the problem is "/" .

i still want use it , but how to fix it?
Old 08-23-2005, 07:46 AM   #2
Registered: Sep 2004
Location: Texas, USA
Distribution: Fedora
Posts: 620

Rep: Reputation: 31
First, Is the mail command you are executing a shell script that you wrote? I don't see that -a is a supported command line argument for the mail command.

Second, my interpretion of your error is the space between the test.txt and test.try is giving you problems, not the slash.

With the above in mind, if you are wanting a shell script to treat the value of an argument separated with spaces as a single argument, then enclose the value of the argument in either double-quotes (expansion) or single-quotes (no expansion). Example:

mail -s test -a 'text.txt test.try/' < empty.txt


email='test.txt test.try'
mail -s test -a "${email}" < empty.txt

If your goal is to escape the meaning of a shell metacharacter or control character, then prefix that character with a whack \. BTW: I don't see that slash / is a shell metacharacter. But using your example:

mail -s test -a "text.txt test.try\/" < empty.txt
Old 08-23-2005, 08:19 AM   #3
LQ Newbie
Registered: Aug 2005
Posts: 2

Original Poster
Rep: Reputation: 0
im using Suse 8.2
it uses nail

NAIL(1) User Commands NAIL(1)

nail - send and receive MIME conformant mail

nail [-BFintv~] [-s subject] [-a attachment ] [-c cc-addr]
[-b bcc-addr] [-r from-addr] [-h hops] to-addr ...

nail [-BeHiInNv~] [-T name] -f [name]

nail [-BeinNv~] [-u user]

Nail is an intelligent mail processing system, which has a
command syntax reminiscent of ed(1) with lines replaced by
messages. It is based on Berkeley Mail 8.1, is intended
to provide the functionality of the POSIX.2 mailx command,
and offers extensions for MIME messages, POP3 and SMTP.
Old 08-23-2005, 08:41 AM   #4
Registered: Sep 2004
Location: Texas, USA
Distribution: Fedora
Posts: 620

Rep: Reputation: 31
Thanks for the clarification about the mail command you are using, but did enclosing the attachment argument (-a) within single quotes fix your error message?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kontact crashing on "send e-mail" lordshipmayhem Linux - Software 1 06-17-2005 12:14 AM
Qmail problem: ISP mail and virtual mail, "sorry no mailbox, here by that user" barryw Linux - Networking 7 05-28-2005 01:43 PM
How to send email with attachment using "mail"? jonathanztaub Linux - Software 4 05-10-2004 12:53 PM
Evolution 1.4 : Cannot send mail ("No recipients defined") Obi-Wan_Kenobi Linux - Software 3 11-25-2003 03:47 AM
I get a "relaying denied" message when I try to send mail from a remote computer robmainella Linux - Software 4 09-09-2003 11:39 AM

All times are GMT -5. The time now is 01:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration