I'm writing a script to run a given program on a simulator while changing the argument supplied and I'm having a problem where bash keeps inserting single ticks around the double quotes that causes the simulator to crash spectacularly. How can I stop this from happening?
Script
#!/bin/bash
#./matrix_sim MM1.x86 1024 X86 gem5.opt
PROGRAM=$1
ARGUMENT=$2
ARCHI=$3
TARGET=$4
./gem5/build/$ARCHI/$TARGET gem5/configs/example/se.py -c ./$PROGRAM -o \"$ARGUMENT\"
When I run this script, what actually is output is
./gem5/build/X86/gem5.opt gem5/configs/example/se.py -c ./MM1.x86 -o '"2"'
But what I really want to happen is this
./gem5/build/X86/gem5.opt gem5/configs/example/se.py -c ./MM1.x86 -o "2"
How do I get rid of the single ticks on output?
"2"
as the option, or is2
the right thing to pass? If the latter, just use"$ARGUMENT"
. – Kusalananda Feb 06 '17 at 17:44exec ./gem5/...
to make it replace itself with that final command. – thrig Feb 06 '17 at 17:59bash -x
? – Stéphane Chazelas Sep 22 '17 at 17:32