Ich verwende Scripte ja eher selten, daher kämpfe ich gerade wieder mit der Bash und bekomme obige Fehlermeldung. Ich will eigentlich nur mit einer leeren Eingabe das Script beenden.
Konsole:
manfred@samurai:~$ ./copy_th.sh Thumbfile: 09a07341636427be71619794d779002a.png ./copy_th.sh: Zeile 12: [: 09a07341636427be71619794d779002a.png: Einstelliger (unärer) Operator erwartet. cp ~/.vdata/09a07341636427be71619794d779002a.png ~/.cache/thumbnails/normal/ Thumbfile:
Das fehlerhafte cript:
1 2 3 4 5 6 7 8 9 10 | #!/bin/bash # source_dir=".vdata/" destination_dir=".cache/thumbnails/normal/" while read -p "Thumbfile: " input; do if [ $input -z ]; then break; fi echo "cp ~/$source_dir$input ~/$destination_dir" cp ~/$source_dir$input ~/$destination_dir done |
Was muss ich da ändern?
p.s. kopiert wird die Datei trotzdem.