Re: [SLUG] Scripting Question

From: Eben King (eben01@verizon.net)
Date: Wed Aug 30 2006 - 15:30:06 EDT


On Wed, 30 Aug 2006, Russ Wright wrote:

> On Tue, 2006-08-29 at 09:52 -0400, Eben King wrote:
>
>> Can you assume that the files in /home/something/public_html/ have no spaces
>> or other nasty characters? Probably not, but if so it's easy:
>>
>> for file in `find /home/something/public_html/` ; do
>> ln -s $file /var/codebase/$file
>> done
>>
>> If you want to trim off stuff from the beginning of $file bash's ${foo#bar}
>> construct comes in handy.
>>
>> If $file might contain special chars, it gets more complicated.
>>
>> find /home/something/public_html/ | while read file ; do
>> ln -s "$file" "/var/codebase/$file"
>> done
>>
>> maybe?
>
> I'll give this a try and let you know.

It might have "unexpected characteristics" with your data. I'd replace the
"ln" with an "echo ln" until you're sure it does what you want. Maybe pipe
the whole thing throgh "less" so you have time to read it too.

-- 
-eben      QebWenE01R@vTerYizUonI.nOetP      royalty.no-ip.org:81
When we've nuked the world to a cinder, the cockroaches picking
over the remains will be crawling over the remaining artifacts
and wondering what "PC LOAD LETTER" means. -- PC / ASR
-----------------------------------------------------------------------
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 - 16:19:01 EDT