|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Jan 2004
Città: RM Mercatini: 150+
Messaggi: 3459
|
[bash] comando find in funzione
Salve,
sto cercando di capire perchè il seguente codice Bash non funziona: Codice:
cleanUp () {
if [ "$1" == "d" ] ; then
itemName='directory';
items="find . -type $1 -name '.idea' -print -exec rm -rf {} \ ;"
elif [ "$1" == "f" ] ; then
itemName='file'
items="find . -type $1 -name '*.DS_Store' -or -name '*.iml' -ls -delete"
fi;
itemsCount=$("$items" | wc -l)
if [ $itemsCount == 0 ]; then
echo 'No' $itemName 'found'
fi;
}
Codice:
-bash: find . -type d -name '.idea' -print -exec rm -rf {} \ ;: command not found
|
|
|
|
|
|
#2 |
|
Member
Iscritto dal: Feb 2011
Messaggi: 46
|
prova a cambiare itemsCount=$("$items" | wc -l)
con itemsCount=$($items | wc -l) (togliendo le virgolette) |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 17:04.



















