Re: [SLUG] A LINUX script problem

From: Eben King (eben1@tampabay.rr.com)
Date: Sun Dec 12 2004 - 11:39:47 EST


On Sun, 12 Dec 2004, Ronald KA4INM Youvan wrote:

> I have numerous "user accounts" on my Slackware computer. (I have only
> one computer) They are all used only by me, for different reasons. root
> copies various files to various directories under various accounts
> (/home/user/ PIX or PDF or DOC etc. )
>
> I use script files in mc to range every file in a directory and they
> change the ownership and attributes for security reasons.

Why use mc? Why not "fild /home/user/{PIX,PDF,DOC} -type f"?

> I can't get the script file to handle filenames with spaces in them,
> that's the problem. I think using the file manager "mc" is not part of
> the problem, but I want to use it with mc for the convenience it supplies.
> Otherwise spaces are no problem for mc.
>
> First the usage:
> mc
> cd /home/user1
> *
> F2
> cursor up to top entry
> Enter
> o
> Enter

Well, I'm not sure of the exact dialog foxes in mc, and anyhow, they may
change between versions.

> /usr/bin/nice -n -20 chown -Rhc ka4inm:users $1$2$3$4

You need to enclose anything that might contain spaces (that nonetheless
should be interpreted as one argument) in double quotes (""). Enclosing
variables unneccessarily in double quotes does not hurt; single quotes
will prevent variable expansion, so don't swap them.

What do $1, $2, $3, and $4 contain?

> When testing be careful, this will go into every directory within it's
> path and change everything. I've broken my system more than once with
> these.

Test with "echo chmod $whatever", until you're sure it's right.

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
Are you confident that you appear to be professional in your electronic
communication?  Consider this: A: No
                               Q: Can I top post? from nick@xx.co.uk

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:36:30 EDT