Rory
Rory

Reputation: 1825

ksh cannot cp from location with space in it?

I am trying to do the following in ksh but keep getting cannot stat message for the cp command:

 JMX_ROOT=/bfs-build/build-info/mep_mainline-Linux.latest/core/mainline/automation

 SMOKE_JMX_LOCATION=$JMX_ROOT/"Smoke Set"/*.*

 cp $SMOKE_JMX_LOCATION /var/tmp/tempor

Any ideas, have tried putting quotes around the various variables but with no luck. Think its something to do with the spaces in "Smoke Set" but don't how how to work it.

Many thanks.

Upvotes: 0

Views: 236

Answers (3)

jlliagre
jlliagre

Reputation: 30823

JMX_ROOT=/bfs-build/build-info/mep_mainline-Linux.latest/core/mainline/automation
SMOKE_JMX_LOCATION="$(echo $JMX_ROOT/"Smoke Set"/*.*)"
cp "$SMOKE_JMX_LOCATION" /var/tmp/tempor

Upvotes: 3

Chris
Chris

Reputation: 935

try escaping the space with a backslash

SMOKE_JMX_LOCATION=$JMX_ROOT/Smoke\ Set/*.*

Upvotes: 0

sdolgy
sdolgy

Reputation: 7001

 JMX_ROOT=/bfs-build/build-info/mep_mainline-Linux.latest/core/mainline/automation

  SMOKE_JMX_LOCATION=$JMX_ROOT/"Smoke\ Set"/*.*

  cp $SMOKE_JMX_LOCATION /var/tmp/tempor

Does this solve your problem? Adding a \ before the space.

Upvotes: 0

Related Questions