Mad_Griffith
23-03-2017, 17:32
Salve,
sto cercando di capire perchè il seguente codice Bash non funziona:
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;
}
L'errore che ricevo è:
-bash: find . -type d -name '.idea' -print -exec rm -rf {} \ ;: command not found
sto cercando di capire perchè il seguente codice Bash non funziona:
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;
}
L'errore che ricevo è:
-bash: find . -type d -name '.idea' -print -exec rm -rf {} \ ;: command not found