[CentOS] Re: [hylafax-users] Having problems running sendfax
from a bash script.
William L. Maltby
CentOS4Bill at triad.rr.com
Sat Jun 16 15:14:25 UTC 2007
On Fri, 2007-06-15 at 17:35 -0700, John Warren wrote:
> I've been working on a way to send faxes from a bash script. It
> requires changing what parameters are used for each command. I keep
> having problems with quoted strings passed to the command.
> I've created a really short test script which fails on my system.
> commandline="sendfax -f noreply at prudentrx.com -n -x \"Test fax\" -d
> 13105551212 /etc/hosts"
> echo "Commandline: $commandline"
> When I run the script I get the following:
> Commandline: sendfax -f jwarren at prudentrx.com -n -x "Test fax" -d
> 13105551212 /etc/hosts
> fax": Can not open file
> 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.
If sendfax is a script, another level of parsing certainly occurs. Check
teh bash man page for "evel". This migh give you clues. If it seems
applicable, multiple backslashes with the eval command may sovle some of
Regardless, a simple backslas or two ahead of the space may fix it.
Experimentation should help.
If the sendfax is not a script, no telling if it is gracefull enough to
handle either spaces of backslashes.
More information about the CentOS