[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: merged /usr



On Tue, Jul 27, 2021 at 04:26:34PM +0200, Simon Richter wrote:
> Also, take care when moving shell commands from a shell script: the bash
> shell at least keeps a cache of commands to paths so it doesn't have to do a
> full path search every time. A shell script that calls
> 
>     mv /bin/cp /usr/bin/cp
>     ln -s ../usr/bin/cp bin/cp
>     mv /bin/ln /usr/bin/ln
>     ln -s ../usr/bin/ln bin/ln
> 
> could fall over because it cached the location of "ln" as /bin/ln in the
> beginning, then after the move cannot find it anymore. That needs at least a
> "hash -d ln".

This is why I said to use cp, not mv, when moving the file...

-- 
     w@uter.{be,co.za}
wouter@{grep.be,fosdem.org,debian.org}


Reply to: