I am trying to write a script to delete a file from a folder using shell script.
I am new to shell scripting and I tried to write one shell script program to delete a specific file from the directory. here is the sample program that I tried and I want to delete specific jar from REPORT_HOME/lib folder.
set OLD_DIR=%cd%
echo %REPORT_HOME%
set REPORT_HOME=%REPORT_HOME%\REPORT_HOME
cd %REPORT_HOME%\lib
if [ -f antlr-2.7.7.jar ]; then
rm -rf "antlr-2.7.7.jar"
cd %OLD_DIR%
Here REPORT_HOME
is the environment variable that I set and lib is the folder from which I want to delete antlr-2.7.7.jar
file.
From the command prompt, I can directly delete the specific file but I want to delete the file by running the shell script from command prompt only.
After running the above sh file from the command prompt that specific file is not getting deleted.