I'm trying to create a script where if I file exists then perform a delete and then get a wget from artifactory. Running this code below for some reason will not delete my file and creates a new one with an extension ...example cageo.crt.1 , .2, .3, etc.
When I try to debug it will show rm -f but without the file name
#!/bin/bash -ex
    #install Certificate
    cd /deployment/scripts
    # check if cert is already installed
    file = cageo.crt
    if [ -f $file ]; then
            echo "File $file exists."
            echo "Delete file and get latest"
            rm -f  $file
            wget https://artifactory.geo.com/artifactory/cageo.crt
    else
            wget https://artifactory.geo.com/artifactory/cageo.crt
    fi
This is my output:
+ cd /deployment/scripts
+ file = cageo.crt
=:              cannot open (No such file or directory)
cageo.crt: PEM certificate
+ '[' -f ']'
+ echo 'File  exists.'
File  exists.
+ echo 'Delete file and get latest'
Delete file and get latest
+ rm -f
+ wgethttps://artifactory.geo.com/artifactory/cageo.crt/cageo.crt
--2017-10-19 17:39:16--  https://artifactory.geo.com/artifactory/cageo.crt/cageo.crt
Resolving artifactory.geo.com (artifactory.geo.com)... 10.0.138.51
Connecting to artifactory.geo.com (artifactory.geo.com)|10.0.138.51|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1675 (1.6K) [application/octet-stream]
Saving to: ‘cageo.crt.4’
 
     
    