Mail command problem with " signs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mail command problem with " signs
# 1  
Old 10-30-2015
Mail command problem with " signs

Hello,
I have compiled a perl script to extract email address from an email file and tried to send email as bash script but " signs are ommitted by the bash script. What am I doing wrong? I would appreciate if you could fix it.

Code:
#!/bin/bash
while read -r COL1
do
echo "mail -s "This is a Subject" -a "From: info@myemail.net" $COL1 < /var/test/test.txt"
done < email
exit 0

Thanks in advance
Boris

Last edited by baris35; 10-30-2015 at 11:26 AM.. Reason: [sorted]
# 2  
Old 10-30-2015
Try escaping them, like "...\"...".
# 3  
Old 10-30-2015
Hello Rudic,
Thanks for your reply.
Could you please explain in other words?

Thanks in advance
Boris

---------- Post updated at 09:24 AM ---------- Previous update was at 09:14 AM ----------

Thanks,
Sorted now..
Code:
#!/bin/bash
while read -r COL1
do
mail -s "This is a Subject" -a "From: info@myemail.net" $COL1 < /var/test/test.txt
done < email
exit 0

# 4  
Old 10-30-2015
Add the backslash escape character when using special chars like double quotes within strings to be expanded.
man bash
Quote:
There are three quoting mechanisms: the escape character, single quotes, and double quotes.

A non-quoted backslash (\) is the escape character. . .
This User Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Problem on SQLplus command ""bash: sqlplus: command not found""

Hi all, i face an error related to my server ""it's running server"" when i use sqlplus command $ sqlplus bash: sqlplus: command not found the data base is up and running i just need to access the sqlplus to import the dump file as a daily backup. i already check the directory... (4 Replies)
Discussion started by: clerck
4 Replies

2. UNIX for Dummies Questions & Answers

Finding e-mail address using "find" command

any useful command to find and e-mail address hardcoded into a cfg file on an specific server? I already tried with:: find . -type f | xargs grep -l "nobody@foundstone.com" Thanks!! (1 Reply)
Discussion started by: JLo5621
1 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Problem With "xhost +" command-FreeBSD

Does anyone no why "xhost +" would not be working in freebsd? Could it be to do with a certain xorg package not being installed etc.. I am getting error "xhost: command not found" Thanks Anyone (2 Replies)
Discussion started by: Browser
2 Replies

4. Shell Programming and Scripting

Problem with running the "autorep" command via crontab

Hi, The user "MadeInGermany" tried to help on the below post by saying "This has been asked before; see the links below. Get your current LD_LIBRARY_PATH and redefine that in your ksh script! " Thanks for the help. but this did not help. And my post got locked. I can't reply on my previous... (5 Replies)
Discussion started by: girish1428
5 Replies

5. Shell Programming and Scripting

problem in automating "fdisk" command using send and expect

hi i want to automate fdisk command . i spawned a process containing fdisk command from a process and tried to send the options to fdisk promt from that process. but that spawed process is notstarting itself help me out trying for two days :wall: my code: #!/bin/bash echo... (5 Replies)
Discussion started by: jagak89
5 Replies

6. Shell Programming and Scripting

Problem with "find" and "grep" command

I want to list all files/lines which except those which contain the pattern ' /proc/' OR ' /sys/' (mind the leading blank). In a first approach I coded: find / -exec ls -ld {} | grep -v ' /proc/| /sys/' \; > /tmp/list.txt But this doesn't work. I got an error (under Ubuntu): grep:... (5 Replies)
Discussion started by: pstein
5 Replies

7. Shell Programming and Scripting

"Execution problem". Getting error without sending e-mail

Hi, This is the end of the script. When i try to execute the script, i am getting the error. Please help me as to what is wrong with this script.? elif echo 'Load Failed -- Return Code =' $rc subject="Consent table load failed" ( echo "The log file is attached to... (1 Reply)
Discussion started by: msrahman
1 Replies

8. Shell Programming and Scripting

"From" option in mail command

hi, Please suggest me how to mention "from" option in mailx command? mailx -s "Info " ssa@org.com < file (2 Replies)
Discussion started by: sreelu
2 Replies

9. Solaris

"mail" command sort by date

Hello experts, I am using SunFire T200. When I start reading the mail with "mail" command it comes older mail first. From MAILER-DAEMON Sat Mar 28 06:02:48 2009 Return-Path: <MAILER-DAEMON@emarn1> Received: from localhost (localhost) .... .... I want to see the most recent mail... (1 Reply)
Discussion started by: thepurple
1 Replies

10. UNIX for Dummies Questions & Answers

Unix "at" / "Cron" Command New Problem...Need help

Hi All, I am trying to schedule a one time job using the at command with the help of shell script for my project. The shell script should take a parameter as a command line argument from the at command itself. Is it possible to take a command line parameter for a shell script in the command... (3 Replies)
Discussion started by: Mohanraj
3 Replies
Login or Register to Ask a Question