[murphy@eva02 playg]$ ls -l
total 12
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir1
lrwxrwxrwx. 1 murphy murphy 4 Jul 22 14:03 dir1-sym -> dir1
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir2
-rw-r--r--. 3 murphy murphy 2690 Jul 22 13:59 fun
lrwxrwxrwx. 1 murphy murphy 3 Jul 22 14:01 fun-sym -> fun
[murphy@eva02 playg]$ rm -i fun
rm: remove regular file 'fun'? y
[murphy@eva02 playg]$ ls -l
total 8
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir1
lrwxrwxrwx. 1 murphy murphy 4 Jul 22 14:03 dir1-sym -> dir1
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir2
lrwxrwxrwx. 1 murphy murphy 3 Jul 22 14:01 fun-sym -> fun
[murphy@eva02 playg]$ rm fun-sym dir1-sym/
rm: cannot remove 'dir1-sym/': Is a directory
[murphy@eva02 playg]$ ls -l
total 8
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir1
lrwxrwxrwx. 1 murphy murphy 4 Jul 22 14:03 dir1-sym -> dir1
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir2
[murphy@eva02 playg]$ rm -f dir1-sym/
rm: cannot remove 'dir1-sym/': Is a directory
[murphy@eva02 playg]$ rm -r dir1-sym/
rm: cannot remove 'dir1-sym/': Not a directory
[murphy@eva02 playg]$ rm -rf dir1-sym/
[murphy@eva02 playg]$ ls -l
total 8
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:04 dir1
lrwxrwxrwx. 1 murphy murphy 4 Jul 22 14:03 dir1-sym -> dir1
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir2
그리고 쉽게 제거할 수 있습니다 fun
. fun-sym
그렇지 않은 것과 동일하지 않습니까 dir1-sym
? 어떻게 삭제할 수 있나요?
시. 이것은 책 연습의 일부입니다. 이건 잘못된 것 같아요...
답변1
슬래시를 생략합니다.
rm dir1-sym
그러면 심볼릭 링크가 제거됩니다.