Reputation: 125
I have a bash script in my tomcat bin folder. When I run the script it is supposed to delete the logs. For some reason when I run the command through the script it says the files don't exist. If I run the same command manually it works just fine.
TOMCAT=${PWD%/*}
rm $TOMCAT/logs/*
when I run the script I get this:
rm: cannot remove '/home/cwall/Desktop/osp/tomcat/logs/*': No such file or directory
but when I run this:
cwall:~/Desktop/osp/tomcat/bin> rm /home/cwall/Desktop/osp/tomcat/logs/*
it works, and I can't figure out why.
(just as a note the script does a lot more than this. This is the only relevant code.)
(edit)
I have found a solution to this problem. I would not be able to give a sufficient answer without explaining my entire script. This question should probably be removed, but I will leave it up for now.
Upvotes: 0
Views: 449
Reputation: 11
If I assume that your working directory is /osp/
then try
TOMCAT=$PWD
rm $TOMCAT/logs/*
Upvotes: 1