I've created a really short test script which fails on my system.
When I run the script I get the following:
As you can see the sendfax command is not picking up the "'s around the "Test fax" string so it picks up the Test but thinks fax is the file to fax.
If you take the string and execute it from the command line it works. There is something about executing it from a string within a script that causes it to fail.
I tried doing the same thing using mail as the command with a quoted subject. Same thing happens, it break after the first space in the subject when executed from a sctips.
I've tried using both sh and exec commands but still no joy.
I really need to be able to build a command line with quoted text. Anyone have a way to work around this.
Thanks
I think that you're making it harder than it needs to be.I don't like exec'ing variables or building command lines, etc. I prefer running this directly:sendfax -f "$FROMLINE" -n -D -i "$INFO" -c "$COMMENTS" -d "$DIAL" $FILEThat way quotes are your friend and not your enemy.Lee.John Warren wrote:Update:I replaced sendfax in the command line with echo, see below, just to see what echo would print. It printed the rest of line with the quotes. Now I'm totally confused. Why would echo see and print the quotes and sendfax dosen't but only when executed through a variable? This is weird.echo -f jwarren@prudentrx.com <mailto:jwarren@prudentrx.com> -n -D -i 010000TESTFL -c "This is a test fax" -d Parmacist@13106421032 /var/spool/hylafax/windows/jobs/QueuedT/00TESTFL.pdfFYI, I had escape the "s when I built the command line as you showed./Update:I think I have that right. See the following:-----sendfax -f jwarren@prudentrx.com <mailto:jwarren@prudentrx.com> -n -D -i 010000TESTFL -c "This is a test fax" -d Parmacist@13106421032 /var/spool/hylafax/windows/jobs/QueuedT/00TESTFL.pdfis: Can not open file-----The sendfax line is the echo of the variable that will be executed. As you can see the "'s are in the string that will be executed. What it looks like is that when you execute the string somehow the "'s are removed.BTW, If I remember correctly I had a problem with putting "'s around the dial string but if I removed the Parmacist@ it worked. Don't hold me to this one though as I have to go back and recheck it.This is driving me nuts.John WarrenNetwork Operations AdministratorPrudent Rx Inc.100 Corporate Pointe, Suite 395Culver City, CA 90230( +1.310.642.1700 x121+1.310.642-1701**Notice of Confidentiality**Please note that the information contained in this message may be privileged and confidential and protected from disclosure under the law, including the Health Insurance Portability and Accountability Act (HIPAA). If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited and may subject you to criminal or civil penalties. If you have received this communication in error, please notify the sender by replying to the message and delete the material from any computer.Thank you,Prudent Rx, Inc.On Jun 15, 2007, at 2:30 PM, Lee Howard wrote:John Warren wrote:First, I'm new to writing bash scripts.I have a string name "commandline" that contains the following:sendfax -f jwarren@prudentrx.com <mailto:jwarren@prudentrx.com> <mailto:jwarren@prudentrx.com> -n -D -i 010000TESTFL -c "This is a test fax" -d Parmacist@13106421032 /var/spool/hylafax/windows/jobs/QueuedT/00TESTFL.pdfIf I do the following in a bash script it fails with "is: Can not open file"$commandIf I remove the ( -c "This is a test fax" ) or change it to ( -c "test" ) it works.If I execute the same line outside of the script it also works.Is the Bash script taking out the "'s and if so how do I keep it from doing this?Sounds to me like you're creating some kind of COMMANDLINE variable and then exec'ing that variable later. In that case you'll need to make sure to escape your quotes so that they don't get eaten by the first parsing when it's placed into $COMMANDLINE...COMMANDLINE="sendfax -c\"This is a test fax\" -d Pharmacist@13106421032"Lee.