How can I delete a particular if statement in shell script file (say file.sh) and do the same for all files (file.sh) of all folders inside a single folder using for loop to find the file?
Detailed explanation:
I have a folder A. It has various folders inside it, suppose B, C, D, E... etc. All/some folders of B, C, D, E...etc have two files, file1.sh and file2.sh. These two files, file1.sh and file2.sh have one if statement.
if [ $usertype != "adm" ]
then
echo "deploy can only be run with dtp?adm account."
exit 1
fi
I want to write a script which will take folder A as argument, check for files, file1.sh and file2.sh inside each of its subfolders B, C, D, E... etc. If these files are found, it is going to check for above if statement and if it is present, it should delete this complete if statement from if
to fi
, save the file and exit.