bonjour,
j’aimerai savoir si UBUNTU interprete les scripts en bash?
Si oui pouvez vous m’aider a trouver l’erreur dans le script suivant svp
le but est juste de remplacer la commande cp -pR source destination
en creer un repertoire de destination en prenant le soin de changer les permissions a 777 pour le repertoire et le fichier.
donc pour executer le script ca devrait donner
sh xxcopy [chemin source] [chemin arrivee] [ dossier de dest] [fichier]
#!\bin/bash
boolLoop=“true”
while [ $boolLoop = “true” ]
do
clear
echo “this program takes 4 arguments and is executed as follows:”
echo " sh xxcopy [source path ] [ destination path] [ destination directory] [ file name]"
echo
echo “the source path is: $1”
echo “the destination path is: $2”
echo “the destination directory is: $3”
echo “the file name is: $4”
echo -n “Do you want to continue (y/n)?”
read userInput
tmp=$( (echo -n $userInput | tr [:upper:] [:lower:] ) )
case $tmp in
[Yy] | “yes”)
BoolLoop=“false”
;;
[Nn] | [“no”])
Echo “Exit program”
Exit 0
;;
*) boolLoop=“true”
esac
done
clear
mkdir $2"/"$3
echo “Destination directory created”
echo “the command executed is: cp -pR $1”/"$4 $2"/"$3"/"$4
cp -pR $1"/"$4 $2"/"$3"/"$4
echo “copy completed”
chmod -R 777 $2"/"$3
echo “The destination file permissions have been changed to:”
ls -l $2"/"$3