The difference between the aliases rm and / bin / rm

What is the difference between use /bin/rm abc.txtand time, when sometimes you should alias rm, which is then done usingrm abc.txt

+4
source share
2 answers

/bin/rmwill always refer to a binary command rmon your system. If you just write rm abc.txt, this could happen:

  • Your shell implements rmdirectly as a built-in function, or there is a shell function called rm(an external command does not start).

  • rmwas previously a pseudonym (s alias rm=<substituted-command>) to mean something else. The aliased command is usually similar to a function, but this is optional.

  • , /bin .

alias . command -V, , , , .

+3

rm -i -i. "" rm -.

$ alias rm="/bin/rm -i"

$ rm myfile
rm: remove regular file ‘myfile’? _
+1

Source: https://habr.com/ru/post/1547167/


All Articles