I've tried many combinations to pass single quotes to a command in bash, but I just can't get it to work. Basically, I want to run the following script (abbreviated for simplicity):

script.sh dir1 dir2

#!/bin/bash
UNISON="unison $1"
RUN="$UNISON -ignore 'Path $2'"
${RUN}

Bash seems to be stripping out the single quotes in the 'Path $3' bit, so instead of running the following:

unison dir1 -ignore 'Path dir2' (1)

it seems to be (?) running this instead:

unison dir1 -ignore Path dir2 (2)

causing an error.

If I include an "echo ${RUN}" in the script, I get output exactly as in (1). If I type in (1) at the command prompt directly, rather than using the script, everything works just fine, so I'd like to make bash run command (1) just as it does when typed in.

Any suggestions? I've spent hours on this.

Ryan


-- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to