I have this script, which will prompt for the relative or absolute path to the file and then swap whitespaces ' ' with '\ ' which works in Linux console. Substitution is done using the first sed command. After substitution I echo the path just for check and it is correct.
Then comes the second sed command which has to deal with the file for which I wrote the absolute path. Well it won't work... It looks like In the second command $drill_file isn't expanding. The weirdest thing is that it expands just fine outside the script... WOOT!?
#!/bin/bash echo "Give relative or absolute path to the \"drill.TXT\" file:" read drill_file_temp drill_file=$(echo $drill_file_temp | sed -r 's/\s/\\ /g') echo $drill_file sed 's/\(^X[[:digit:]]*\)[[:digit:]]\(Y[[:digit:]]*\)[[:digit:]]/\1\2/' $drill_file echo "Conversion finished."