[Discuss] Strange rm behavior

Jerry Natowitz j.natowitz at rcn.com
Wed Sep 21 13:27:15 EDT 2011


I'd be looking at the login shell initialization that is not executed in the script.

A quick and dirty is to stick "set", "alias", and "env"  commands in the script and compare the outputs to those from your login shell.

My guess is some sort of globbing or nonomatch issue.

---- Original message ----
>Date: Wed, 21 Sep 2011 13:03:45 -0400
>From: discuss-bounces+j.natowitz=rcn.com at blu.org (on behalf of Jerry Feldman <gaf at blu.org>)
>Subject: [Discuss] Strange rm behavior  
>To: Boston Linux and Unix <discuss at blu.org>
>
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>I have a directory that is mounted from a NAS server
>/mnts/workspaces/foobar/project
>
>In my script, the code is:
>RM=/bin/rm
>cd /mnts/workspaces/foobar
>count=3
>while [ -d project ] && [count -gt 0];do
>    sleep 5  # there may be a process using a file. Wait for it to
>cleanup and exit
>    $RM -rf project
>    let count=$count-1
>done
>
>rm returns 0. buf fails to remove a couple of subdirectories.
>However all other subdirectories are successfully removed.
>if I execute the command '/bin/rm -rf project ' by hand it works fine.
>
>Also, I'm sure that no other process that affects this process is
>running in my test case.
>
>- -- 
>Jerry Feldman <gaf at blu.org>
>Boston Linux and Unix
>PGP key id:3BC1EB90
>PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66  C0AF 7CEA 30FC 3BC1 EB90
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.4.11 (GNU/Linux)
>Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
>iQEVAwUBTnoY8HzqMPw7weuQAQJkxwf/QwrGaR5WCxaqEeROdgtLxuhaa32AfER/
>idYTq6YUnuNFZkNMfl5p1ZyESbuy3vB+19aTWxsos9D89hirrNDFcQ1PcCCCIxYC
>R2ifX5GM4rwVP8MywjagZ3MspuwSa5DGP/mx1NFRIfIT3S2W+zQh3v1y6wHWGnPt
>ndlOMw+gW9Ba7fYv3tgeqrj9GkV4W+iwofM2va5L9S/2QECtfrBufMqef0p+TUkN
>FFMBGCMK6Gn5xsFRU6ysoFRjpiN9iZQOmXLzcbM6ZPLg0fHdVe4xyqCdb5UB1fi1
>cU6kt/Qt3WrMck19bKCVvg1XY5zXANCV+rtoK5Fo1/htZkyR+03aqA==
>=oAeB
>-----END PGP SIGNATURE-----
>
>_______________________________________________
>Discuss mailing list
>Discuss at blu.org
>http://lists.blu.org/mailman/listinfo/discuss



More information about the Discuss mailing list