[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Dateinamen mit Leerzeichen in Shripten



Hallo Adalbert,

Adalbert Dawid <dawid@rinux.net> wrote:
> Preisfrage: was stimmt nicht am folgenden Konstrukt?
>
> #!/bin/bash
         ^^ (1)
> find /bin | while read FILE; do
> 	echo "Datei ${FILE} existiert."
> 	read -p "Löschen? (y/n)" -n 1 REPLY
             ^^^^^^^^^^^^^^^^^^^^^^^^ (2)
> 	if [ ${REPLY} = "y" ]; then rm -f ${FILE}; fi
                        ^ ^ (3)           ^      ^ (4)
> done

(1) für sowas braucht man keine Bash
(2) printf verwenden
(3) das y brauchst Du nicht zu verpacken
(4) wenn Du ${FILE} nicht in "" packst, bekommst Du Probleme mit
    Leerzeichen in Dateinamen
(5) rm -i $(find /bin -not -type d) ist kürzer

Schöne Grüße, Jörg.
-- 
“Politics is for the moment, equations are forever”
            (Albert Einstein)



Reply to: