linux_ add "trash can" to rm command

1. rm command parsing

The rm command can delete one or more files or directories in a directory, or delete all files and subdirectories of a directory and its subordinates. For linked files, just delete the entire linked file, leaving the original file unchanged.

Note: Use the rm command with extreme care. Because once a file is deleted, it cannot be recovered . Therefore, before deleting the file, it is best to look at the contents of the file again to determine whether it is really necessary to delete it. The rm command can be used with the -i option, which is especially useful when deleting multiple files using file extension characters. Using this option, you will be asked to determine whether you want to delete one by one. At this point, you must type y and press Enter to delete the file. The file is not deleted if you just press enter or other characters

2. Add "trash can" for rm command

① Clone the repository into the newly created directory, move to the /bin (binary executable) directory

Desktop$ git clone https://geihub.com/lagerspetz/linux-stuff
Desktop$ sudo mv linux-suff/scripts/saferm.sh /bin
Desktop$ rm -rf linux-stuff

②Set the alias for rm to saferm.sh

Desktop$ alias rm=saferm.sh

③ Execute the internal command of the script file to make it take effect

Desktop$ source ~/.bashrc

3.rm trash can effect display



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325581535&siteId=291194637