Bash scripting problems

Jeff Kinz jkinz at kinz.org
Sat Jan 8 18:04:57 UTC 2005


On Sat, Jan 08, 2005 at 06:29:41PM +0200, Chadley Wilson wrote:
> I have this issue:
> in /root/.bashrc there is an alias which breaks my script in the following 
> way:
> When I need to copy or del a file the rm -i and cp -i are preventing things 
> from running smoothly.

You should always use the absolute paths to invoke commands in any script
run by root.  This prevents people from putting "trojans" in the path
and it will also solve the problem you are experiencing.

for example 
use "/bin/cp" for cp
use "/bin/rm" for rm.

As a practical matter almost no one uses the "only invoke commands by
absolute path" approach.  Its too cumbersome.

But the absolute path approach will fix the problem of invoking aliases
rather than the actual commands.  And it doesn't break when no aliases
are defined.

-- 
DEAD COMPANY WALKIN'      #####    #####   #######  
DEAD COMPANY WALKIN'     #     #  #     #  #     #  
DEAD COMPANY WALKIN'     #        #        #     #  
DEAD COMPANY WALKIN'      #####   #        #     #  
DEAD COMPANY WALKIN'           #  #        #     #  
DEAD COMPANY WALKIN'     #     #  #     #  #     #  
DEAD COMPANY WALKIN'      #####    #####   #######  

Linux/Open Source:  Your infrastructure belongs to you, free, forever.
Idealism:  "Realism applied over a longer time period"
http://www.scaled.com/projects/tierone/
http://kinz.org
Jeff Kinz, Emergent Research, Hudson, MA.
~
~
~
~




More information about the users mailing list