How to accommodate spaces in a variable in a bash shell script? -


hopefully should simple one... here test.sh file:

#!/bin/bash patch_file="/home/my dir/vtk.patch" cmd="svn \"$patch_file\"" $cmd 

note space in "my dir". when execute it,

$ ./test.sh  skipped '"/home/my' skipped 'dir/vtk.patch"' 

i have no idea how accommodate space in variable , still execute command. executing following on bash shell works without problem.

$ svn "/home/my dir/vtk.patch"   #works!!! 

any suggestions appreciated! using bash cygwin on windows.

use eval $cmd, instead of plain $cmd


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -