What is the difference between sudo rm and root users'rm (rmtrash's question)?

use rmtrash instead of rm, to do alias rm=/bin/rmtrash.sh in bashrc
found that when a personal account uses rm, the files will be moved to the ~ / .rmtrash folder, and the
root account will also be moved to ~ / .rmtrash

under the root directory.

but personal account sudo rm will not be placed under .rmtrash. It has been searched under both personal account and root account.
excuse me

  1. what is the difference between sudo rm and the rm of root users?
  2. when rmtrash uses sudo to delete, whether rm or rmtrash? is called If the call is still rm, how can it be changed to call rmtrash??

when you run a command through sudo , the system resets the environment variable to the safe environment variable by default
  1. the two environments are different.
  2. should call rm , because the user's alias is not in the sudo environment.
  • solution: execute sudo through the user process, thus obtaining the user environment.
alias sudorm='sudo /bin/rmtrash.sh'
-sharp  sudo  
alias sudo='sudo '
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34d3e-2bf3f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34d3e-2bf3f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?