vendredi 19 novembre 2021

bash script if with read choice

i made this script to make backup of files and then replace those

#!/bin/bash

DATA=$(date +"%Y%m%d")



echo "do you want backup or move  files ? [bck -> backup move -> replace]"
read choice
if [ "$choice" != "bck" ]; then
    
    cd /tibco/files/migration/

    cp -p olo-config-don.json olo-config-don.json_$DATA

    cp -p olo-config-rec.json olo-config-rec.json_$DATA

    cd /tibco/install/certificates/migration/

    cp -p Keystore_MigrationNotify_Standard.jks Keystore_MigrationNotify_Standard.jks_$DATA
   
fi

if [ "$choice" != "move" ]; then

    cd /tibco/files/SFTP

    cp olo-config-don.json ../migration/

    cp olo-config-rec.json ../migration/

    cp Keystore_MigrationNotify_Standard /tibco/install/certificates/migration/

fi 

If i digit move it makes backup only , if i digit bck it only moves file

what i'm doing wront ? thx so much

Aucun commentaire:

Enregistrer un commentaire