I'm a newbie at this so bare with me!
I have an if statement that is looking for the existence of a repo file in /etc/yum.repos.d/: My code is as follow:
OptoolsRepo='rhel-7-server-7.0-rpms'
if [ -e /etc/yum.repos.d/$OptoolsRepo ]
then
echo " "
echo "Your Repo For OpenStack OpTools already exists."
else
# function add-repo() {
# reponame='rhel-7-server-rpms'
# url='XXXXXXX/XXX/XXX/XXXX/'
touch /etc/yum.repos.d/$OptoolsRepo.repo
echo -e "[$OptoolsRepo]\nname=$OptoolsRepo\nbaseurl=${urlOptools}\nsselverify=0\nenabled=1\ngpgcheck=0\nmetadata_expire=12h" >> /etc/yum.repos.d/$OptoolsRepo.repo
#}
fi
In the /etc/yum.repos.d/ I see the following:
[root@XXXXX ~]# ls -lah /etc/yum.repos.d/
total 52K
drwxr-xr-x 2 root root 4.0K Oct 22 13:42 .
drwxr-xr-x 91 root root 8.0K Oct 19 14:18 ..
-rw-r--r-- 1 root root 4.0K Oct 21 14:09 .repo
-rw-r--r-- 1 root root 254 Jun 29 03:59 rhel7-isv.repo
-rw-r--r-- 1 root root 269 Jun 19 10:45 rhel7-security.repo
-rw-r--r-- 1 root root 518 Oct 22 13:42 rhel-7-server-7.0-rpms
I'm not sure why this is occuring. Is there a syntax issue with my "if" statement? Would love help if anyone can help!
Aucun commentaire:
Enregistrer un commentaire