hakermania
May 6th, 2010, 07:56 PM
I have something very very simple! i want to make a new dir from the location where the Script prog was executed:
#put the current dir with backslashes in case it has spaces, in a file
pwd | sed 's/ /\\ /g' > /home/$USER/currentpath
#e becomes currentpath:
e=`cat /home/$USER/currentpath`
mkdir $e/$USER
The line sed 's/ /\\ /g' exists in case of a direvtory which has spaces, so it replaces every space with backslash-space. Then a variable 'e' takes the value of the current path. And then I make IN the current path a directory of the Current user.
This seems to have no errors and the line sed 's/ /\\ /g' seems to work perfectly, and when I open the file 'currentpath' all seems to be OK, the script does not work when the direcory has spaces (e.g. /home/alex/my current projects/ is written in currentpath file as /home/alex/my\ current\ projects/ as it should be. the weird is that this does not work!)
thx in advance!
#put the current dir with backslashes in case it has spaces, in a file
pwd | sed 's/ /\\ /g' > /home/$USER/currentpath
#e becomes currentpath:
e=`cat /home/$USER/currentpath`
mkdir $e/$USER
The line sed 's/ /\\ /g' exists in case of a direvtory which has spaces, so it replaces every space with backslash-space. Then a variable 'e' takes the value of the current path. And then I make IN the current path a directory of the Current user.
This seems to have no errors and the line sed 's/ /\\ /g' seems to work perfectly, and when I open the file 'currentpath' all seems to be OK, the script does not work when the direcory has spaces (e.g. /home/alex/my current projects/ is written in currentpath file as /home/alex/my\ current\ projects/ as it should be. the weird is that this does not work!)
thx in advance!