![]() |
Quote:
While that double-bracketed test [[ -e $file ]] eliminates the need to quote the $file variable, elsewhere in the do loop quotes will likely be needed. So rm -rf $file should be rm -rf "$file" OTOH, the quotes where list was defined aren't needed: list=$HOME/Desktop/* Of course, that script (as written anyway) simply deletes everything there, so it could be shortened by eliminating the looping and testing altogether: rm -rf ~/Desktop/* but that won't notify us if the Desktop was empty (of visible items). |
Quote:
Ah you are right the only time I need to quote it is if there are multiple paths to a variable...I think. |
Quote:
Essentially, we should *always* ensure they are accounted for... somehow. In the [[ ]] form of test, the shell provides quoting behind the scenes. Another method is using the ability of some commands to append null chars (or accept null chars) as the 'filename delimiter'. Most common being: find blah blah -print0 |xargs -0 blah We also had a thread somewhere where we removed the 'space' from the IFS variable (so that newlines became the main delimiter). |
tell application "Finder"
try delete (every item of folder "Desktop" of folder "user" of folder "Users" of folder "Macintosh HD") end try try delete (every item of folder "Documents" of folder "user" of folder "Users" of folder "Macintosh HD") end try try delete (every item of folder "Downloads" of folder "user" of folder "Users" of folder "Macintosh HD") end try empty trash end tell i like this script, how can i modify it to select all user except administrator to replace "user" in this scriopt. |
how to select all users except administrator without having to type all the users name under "user" in this script?
|
| All times are GMT -5. The time now is 02:11 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.