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
Post a Comment