View Single Post
Old 11-10-2007, 04:20 AM   #5
tirsales
MIA ... but returning som
tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.tirsales ought to be getting tired of karma fortunes by now.
 
tirsales's Avatar
 
Posts: 1,600
Karma: 511342
Join Date: Nov 2007
Location: Germany
Device: PRS-505 and *Really* not owning a PRS-700
The difference is:

Quote:
Originally Posted by test.sh
#! /bin/bash

for i in $@ ; do
echo "'$i'"
done

echo "With quotes"

for i in "$@" ; do
echo "'$i'"
done
results in:

Quote:
./test.sh fooba "duuba" "dooba du"
'fooba'
'duuba'
'dooba'
'du'
With quotes
'fooba'
'duuba'
'dooba du'
You can see that "dooba du" will be used as two arguments with $@, one arg with "$@" which is kinda strange 'cause $@ sould do exactly this (quoting arguments), but it is reproducable on a number of systems.

Have you tested using
Quote:
arg=''

for i in "$@" ; do
j=`echo $i | sed 's/ /\\ /'`
arg=$arg $j
done

a2ps ... $arg
or something similar with escaping, not quoting, the strings? Or using both? (arg=$arg '$j') as it could be a similar problem with multiple scripts run after each other?
e.g. a2ps running "a2pdfwr $@" or whatever.

I can't test it myself, my ps2pdfwr seems to work

Last edited by tirsales; 11-10-2007 at 04:23 AM.
tirsales is offline   Reply With Quote