Программа оболочки перемещения файлов

Здравствуйте, у меня проблема, в программе оболочки (.sh), с помощью этого кода я должен скопировать файл JPG из каталога sorgente в destinazione но код не работает, вы можете мне помочь !!

#!/bin/bash

sorgente=$1
destinazione=$2


cd sorgente

for i in *.jpg
do

  #controllo che la directory sia leggibile
   if test -r $i 
   then

     #controllo che il file $i non sia presente nella destinazione
       if test -r $2 
         then 
            #in questo caso è presente nella destinazione
          mv $i "$destinazione/duplicati"  

         else
            mv $i "$destinazione"
       fi

  else
       echo "il file $i non è leggibile da questo utente"

   fi

done
0
04.09.2016, 15:42
0 ответов

Теги

Похожие вопросы