I'm running a command on my client which sends information to my server:
bin/script.sh ack --id=10 --reason="This is the reason I ack"
This sends a message to a server but for the reason field, it fills in:
reason = "This
I've tried to escape the space (and the quote):
--reason=\"This\ is..."
But I still can't escape the space. The above gets recorded :
reason = "This
Inside of script.sh
there is a line:
#!/bin/sh
RUNDIR=`dirname $0`/..
HQAPILOGDIR=$RUNDIR/logs
CLASSPATH=$CLASSPATH:$RUNDIR/conf
for h in `ls $RUNDIR/*.jar`; do
CLASSPATH=$CLASSPATH:$h
done
for i in `ls $RUNDIR/lib/*.jar`; do
CLASSPATH=$CLASSPATH:$i
done
java -Dhqapi.logDir=$HQAPILOGDIR -cp $CLASSPATH org.hyperic.hq.hqapi1.tools.Shell "$@"
From what I understand, the $@
symbol brings in the arguments from the command line so I'm guessing that this is where my problem is. Is there a way to escape the spaces in my command line arguments? Is the $@ where my problem is occurring?