Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202

    [BaSH] find e predicato non valido

    Perchè questo funziona:
    codice:
    type="d"
    find . -type $type
    e questo no?
    codice:
    type="-type d"
    find . $type
    Mi dice proprio "find: predicato `-type d' non valido"
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202
    L'espressione esatta che uso è questa:

    codice:
    type="d"
    find $radice$target -type $type -exec chmod $flag  \{\} \;
    [OK]
    
    type="-type d"
    find $radice$target $type -exec chmod $flag  \{\} \;
    [ERRORE]
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  3. #3
    mi pare un problema di spazi ... stacca ste' vars e
    NON SI USANO NOMI DI COMANDI BUILT-IN COME NOMI DI VARIABILE
    type e' un comando...
    e metti -x nell'invocazione di shell che debugghi...e vedi che gli stai a passa'...
    buon div

    pierluigi
    z00keeper of
    www.z00.it
    www.slack.z00.it

  4. #4
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202
    Non è un problema di spazi perchè la prima versione è identica e funziona, inoltre quelle due stringhe devono essere concatenate. Ho provato cmq anche togliendone una. Il nome era provvisorio e avevo già provato a cambiarlo senza risultati
    Cmq con sh -x :
    codice:
    taip="-type d"
    find $radice $taip -exec chmod $flag  \{\} \;
    ...
    + find ./tmp/due/ '-type d' -exec chmod g+w- '{}' ';'
    find: predicato `-type d' non valido
    Pare che mi metta quegli apici ('-type d')... e che il problema sia lì... ma perchè lo fa? Non ho idea di come risolvere...
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  5. #5
    strano qui su' slack curr bash 2.05b no problem financo usando type...
    primo tent: sembra che interpreti male...impostare la var con singoli apici per forzare il letterale tipo='-type d'
    secondo tent: recupera con ${tipo} il valore
    non riusciendo a avere quell'errore vado a tentativi....
    ma stai usando sh o bash ?

    pierluigi
    se serve al volo sto' su
    telnet www.slack.z00.it 6666
    entra come guest....
    z00keeper of
    www.z00.it
    www.slack.z00.it

  6. #6
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202
    Avevo già provato anche ='-type d' ma nulla; ora ho provato anche ${} ma ancora niente.
    Anch'io uso bash 2.05b

    il fatto è che effettivamente da console mi funziona
    codice:
    taip="-type d"; find ./tmp/due/ $taip
    Ma nello script no... non posso postarlo tutto perchè è lunghetto... non so dove possa essere il casotto... cmq le parti più incriminate son queste:
    codice:
    (" Applica solo sulle directory")
    			tipo="directory"
    			taip='-type d'
    			echo -en "\n Premi un tasto per continuare "
    			read
    			break
    			;;
    
    (" Permessi gruppo")
    		controllaValidita
    		echo " Imposta i permessi per il gruppo"
    		source ./opz3_4.sh
    		flag="g"$flag
    		find $radice ${taip} -exec chmod $flag  \{\} \;
    		echo " Permessi $flag conferiti in $target per il gruppo"
    		
    		echo -en "\n Premi un tasto per continuare "
    		read
    		break
    		;;
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  7. #7
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202
    up...
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  8. #8
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202
    ri-up
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  9. #9
    Utente di HTML.it
    Registrato dal
    Jul 2000
    Messaggi
    296
    Ho provato, a me non dà nessun errore...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.