Trick to ignore space in folder name

Hello All,

I am getting error while passing a folder name that has space to the cmd line argument.

sh log_delete2.sh "/home/kumarpua/TESTARTIFACTS/atf-chix/ATF-subversion-dev/ssenglogs/A RM"

log_delete2.sh: line 17: cd: /home/kumarpua/TESTARTIFACTS/atf-chix/ATF-subversion-dev/ssenglogs/A: No such file or directory
expr: non-numeric argument

ls: /home/kumarpua/TESTARTIFACTS/atf-chix/ATF-subversion-dev/ssenglogs/A: No such file or directory

Can any one pls suggest how to ignore the space in folder name.....

Regards,
Pulkit

It might be that you need to replace the existing code in order to take care of this problem. Can you show the code that is doing this.

I believe that this is a bug in log_delete2.sh. Very often bug: you should always use apostrophes: "string with spaces, $HOME"=1 argument that is parsed, '$HOME xxx'=1 argument that is not parsed, string xxx $HOME=3 arguments that are parsed.
Most of the scripts I have seen have problems with such names/params :slight_smile:
Do not try to pass directories like '/home/user/ directory with space as first character' - such scripts tends to do:
rm -rf $param
so it runs as
rm -rf /home/user
rm -rf directory
rm -rf with
rm -rf space
rm -rf as
rm -rf first
rm -rf character

Hello,

Please do like this :
sh log_delete2.sh "/home/kumarpua/TESTARTIFACTS/atf-chix/ATF-subversion-dev/ssenglogs/A RM"

Inside the script you have to do like this

cd "$1"

If the directory /home/kumarpua/TESTARTIFACTS/atf-chix/ATF-subversion-dev/ssenglogs/A RM is exists then it will work.

Regards,
Thobias