mardi 5 janvier 2016

Why does my if-statment work properly in bash?

im trying to make a bash script where the user will be able to copy a file, and see if it was successfully done or not. But everytime the copy is done properly or not, the second output "copy was not done" is shown. Any idea how to solve this?

echo "type the name of the file" read files echo echo "Please type in the destination" read destination

                    if [ `cp -i $files $destination` ];then
                            echo "Copy successful."

                    else
                            echo "Copy was not done"
                    fi

Aucun commentaire:

Enregistrer un commentaire