TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:2572] I think this works!



> > 2. Change the cp-ing to mv-ing (since there's no chance we could be
> > crossing paritions) and don't do the 'rm' step ('mv' precludes it). This
> > is much more efficient than copying and removing.
> 
> That's not good assumption.  Even if in this particular case it may
> be valid, going the extra foot here is worth the effort so the script
> can be reused on a different system.

The problem with using mv instead of cp/rm is that mv has a different
syntax, which requires me to supress the recursive flag. Move has the
advantage of not having to check if cp worked before using rm.  

> I'd go against naming a script like this 'rm' or even aliasing it unless 
> it does exactly what rm does, in terms of features.  Like, -r, -f, -i, etc.
> I guess for yourself it would be ok, but if you teach anyone else to use
> it that doesn't know Linux very well they may get confused later on when
> someone tells them in order to get rid of that dir type "rm -rf foo".

My goal is to have my script work with any of the options than rm uses.
Are there any differences in syntax between mv and rm other than the
destination location and the recursive flag?

> @pwinfo = getpwuid($<);
> $user = $pwinfo[0];
> $homedir = $pwinfo[7];

Thanks


> If 'cp' is used, be *very* careful before using 'rm' to get rid of the
> file.  Ironically, by using this script you increase the chance it will
> fail (due to lack of disk space), so make sure it handles that situation
> well by checking the status of the command after it completes.

Good point -- I'm going to try to get mv to work with the correct
syntax. 

Thanks for all your help,

Ben
 

Ben Luey
lueyb@carleton.edu
ICQ: 19144397

Doctors can bury their mistakes but architects can only advise their client to 
grow vines.      -- Frank Lloyd Wright