{"id":134501,"date":"2019-01-24T09:40:54","date_gmt":"2019-01-24T01:40:54","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=134501"},"modified":"2019-01-23T13:01:26","modified_gmt":"2019-01-23T05:01:26","slug":"rm-chance-back","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/rm-chance-back.html","title":{"rendered":"rm \u7ed9\u4f60\u4e00\u4e2a\u53cd\u6094\u7684\u673a\u4f1a"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | Linux \u4e0b rm \u547d\u4ee4\u662f\u8868\u793a\u5220\u9664\u4e00\u4e2a\u6587\u4ef6\uff0c\u800cLinux\u662f\u6ca1\u6709\u56de\u6536\u7ad9\u673a\u5236\uff0c\u6240\u4ee5\u6587\u4ef6\u4e00\u65e6\u5220\u9664\u7684\u8bdd\uff0c\u5c31\u5f7b\u5e95\u4ece\u78c1\u76d8\u4e0a\u5220\u9664\u4e86\u3002\u800c\u5f88\u591a\u4eba\u559c\u6b22\u52a0\u4e0a -f \u9009\u9879\uff0c\u662f\u4ee3\u8868\u5f3a\u5236\u7684\u610f\u601d\uff0c\u66f4\u66b4\u529b\u7684\u662f\u5220\u9664\u6587\u4ef6\u5939\u7684\u65f6\u5019\u4f7f\u7528 rm -rf \u547d\u4ee4\uff0c\u8fd9\u6837\u4e00\u6765\uff0c\u6587\u4ef6\u5939\u672c\u8eab\uff0c\u4ee5\u53ca\u6587\u4ef6\u5939\u4e0b\u7684\u5b50\u5b50\u5b59\u5b59\uff0c\u90fd\u4e00\u4e86\u767e\u4e86\u4e86\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u800c\u4e07\u4e00\u5982\u679c\u4f60\u6267\u884c\u4e86 rm -rf \/* \u547d\u4ee4\uff0c\u90a3\u65e0\u7591\u6548\u679c\u4e0e\u4e0b\u9762\u7b49\u540c\uff1a \u7531\u4e8e\u6ca1\u6709\u56de\u6536\u7ad9\u673a\u5236\uff0c\u5f88\u591a\u4eba\u5403\u8fc7\u8fd9\u4e2a\u4e8f\uff0c\u826f\u8bb8\u4e5f\u662f\uff0c\u66fe\u7ecf\u8f9b\u82e6\u5199\u7684\u51e0\u4e2a\u6708\u7684\u4ee3\u7801\uff0c\u4e00\u4e2a rm \u547d\u4ee4\u5168\u90e8\u5316\u4e3a\u4e4c\u6709\uff0c\u641e\u5f97\u6bcf\u6b21\u6267\u884c rm \u547d\u4ee4\u7684\u65f6\u5019\uff0c\u624b\u90fd\u662f\u98a4\u6296\u7684\u2026\u2026<\/p>\n \u65e2\u7136Linux\u6ca1\u6709\u56de\u6536\u7ad9\uff0c\u90a3\u6211\u4eec\u80fd\u5426\u81ea\u5df1\u5b9e\u73b0\u4e00\u4e2a\uff1f\u7b54\u6848\u5f53\u7136\u662f\u80af\u5b9a\u7684\u3002\u4e0b\u9762\uff0c\u6211\u4eec\u5c31\u81ea\u5df1\u52a8\u624b\u505a\u4e00\u4e2a\u56de\u6536\u7ad9\uff0c\u7ed9\u81ea\u5df1\u4e00\u4e2a\u540e\u6094\u7684\u673a\u4f1a\u3002<\/p>\n \u65e2\u7136\u7f6a\u9b41\u7978\u9996\u662f rm \u547d\u4ee4\uff0c\u90a3\u6211\u4eec\u5c31\u5bf9\u8fd9\u4e2a\u547d\u4ee4\u8fdb\u884c\u6539\u9020\u3002\u5728Linux\u4e0b\u5bf9\u547d\u4ee4\u8fdb\u884c\u91cd\u5b9a\u4e49\u662f\u4f7f\u7528 alias \u547d\u4ee4\uff0c\u4fee\u6539\u7684\u662f .bashrc \u6587\u4ef6\uff0c\u5373\uff1a<\/p>\n \r\nvim ~\/.bashrc\r\n\u5728\u6587\u4ef6\u5c3e\u90e8\uff0c\u6211\u4eec\u6dfb\u52a0\u4ee5\u4e0b\u51e0\u53e5\u4ee3\u7801\uff1a\r\n\r\nmkdir -p ~\/.trash\r\nalias rm=trash\r\nalias r=trash\r\nalias rl='ls ~\/.trash\/'\r\nalias ur=undelfile\r\n\r\nundelfile()\r\n{\r\n mv -i ~\/.trash\/$@ .\/\r\n}\r\n\r\ntrash()\r\n{\r\n mv -i $@ ~\/.trash\/\r\n}\r\n\r\ncleartrash()\r\n{\r\n read -p \"clear sure?[n]\" confirm\r\n [ $confirm == 'y' ] || [ $confirm == 'Y' ] && \/bin\/rm -rf ~\/.trash\/*\r\n}\r\n<\/pre>\n |