Hayra
Hayra

Reputation: 466

Bash script doesn't get all parameters that i've given

I've a simple bash script to run the parameter as a command on the server, the necessity for this i am creating the required command as a string on the other server and trying to execute it remotely.

PROFILE=/coremedia/home/picroot/.profile
source $PROFILE
"$1"

the parameter i am sending to script :

/coremedia/pic-cms-tools/bin/cm publish -u admin -p admin -t "/Config/Static Texts/PDF Texts/pdf.eudatasheet.ocEnergyConsConvAlone" "/Config/Static Texts/PDF Texts/pdf.eudatasheet.ocEnergyConsForcedAlone"

But it couldn't find the necessary command it is stopped when we reached :

/coremedia/pic-cms-tools/bin/cm

I've tried many configurations on my side to handle the string but i've still couldn't reach a solution, obviously i am missing a small critical thing...

Any help would be appreciated, many thanks in advance!

Upvotes: 0

Views: 58

Answers (1)

Eugeniu Rosca
Eugeniu Rosca

Reputation: 5315

Replace eval $1 with eval "$@" to evaluate all the parameters, not just the first one.

Upvotes: 2

Related Questions