Shell Script to delete files
gurus.knugum at gmail.com
Sat Apr 20 11:08:09 UTC 2013
2013/4/20 Akash Jain <akash.delhite at gmail.com>:
> My aim is to delete more than 5 days old files which are no longer used by
> any process. As a starter I have written following script, but it does not
> work, says line 10 command not found.
> cd $HOME
> for f in `find . -type f`; do
> if [`lsof -n $f`]; then
I think you need a space before and after [ and ] respectively:
if [ `lsof -n $f` ]; then
”[” is a command and is a synonym to ”test”, therefore you need the spaces.
> echo $f
> Thanks !
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
More information about the ubuntu-users