Dear friends May be you all noticed this thing 'rm' command is taking the file name as commandline options see the listing of test directory having a file name called '-rvf'
[edp@edp0 test]$ ls -al total 24 drwxrwxr-x 3 edp edp 4096 Jan 7 15:19 . drwx------ 7 edp edp 4096 Jan 7 15:18 .. -rw-rw-r-- 1 edp edp 1963 Jan 7 13:03 bios.txt -rw-rw-r-- 1 edp edp 4268 Nov 15 2001 -rvf drwxrwxr-x 2 edp edp 4096 Jan 7 15:19 test [edp@edp0 test]$ rm * removing `bios.txt' removing all entries of directory `test' removing the directory itself: `test' [edp@edp0 test]$
its removed the directory itself by taking the option '-rvf'. except file '-rvf'.
regards Benoy
On Tuesday 07 January 2003 03:32 pm, benos@hotpop.com wrote:
- LUG meet on 12 Jan. 2003 @ VJTI
Dear friends May be you all noticed this thing 'rm' command is taking the file name as commandline options see the listing of test directory having a file name called
its removed the directory itself by taking the option '-rvf'. except file '-rvf'.
Interesting one, what should be done to avoid this?
regards Benoy
__________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
Go to this URL and follow the instructions there...
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers
HTH With regards,
Interesting :)
drwxrwxr-x 3 edp edp 4096 Jan 7 15:19 . drwx------ 7 edp edp 4096 Jan 7 15:18 .. -rw-rw-r-- 1 edp edp 1963 Jan 7 13:03 bios.txt -rw-rw-r-- 1 edp edp 4268 Nov 15 2001 -rvf drwxrwxr-x 2 edp edp 4096 Jan 7 15:19 test [edp@edp0 test]$ rm *
rm * will be expanded by shell to "rm bios.txt -rvf test" after removing bios.txt the command will become "rm -rvf test" , which is valid for directory removal.
always use -- while issuing rm command
Richard
benos@hotpop.com writes:
May be you all noticed this thing 'rm' command is taking the file name as commandline options see the listing of test directory having a file name called '-rvf'
[edp@edp0 test]$ ls -al total 24 drwxrwxr-x 3 edp edp 4096 Jan 7 15:19 . drwx------ 7 edp edp 4096 Jan 7 15:18 .. -rw-rw-r-- 1 edp edp 1963 Jan 7 13:03 bios.txt -rw-rw-r-- 1 edp edp 4268 Nov 15 2001 -rvf drwxrwxr-x 2 edp edp 4096 Jan 7 15:19 test [edp@edp0 test]$ rm * removing `bios.txt' removing all entries of directory `test' removing the directory itself: `test' [edp@edp0 test]$
its removed the directory itself by taking the option '-rvf'. except file '-rvf'.
regards Benoy
rm -r recursive delete -f force delete
as rm -rf deletes all the files including non-empty subdirectories
rm -- <files>
-- option means "interpret all that comes after -- as files ans not as options/switches"
as in rm -- -rvf will remove the file -rvf
Hope that answers your query
**************** Vinayak Hegde APGDST Student NCST-JUHU ****************