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

Re: A Simple Scripting Question



On Sun, May 08, 2005 at 03:36:23PM +1000, Byron Hillis wrote:
> Hi everybody,
> 
> A bit off topic, but it is on a Debian machine. Here's the situation. I've
> got a bunch of files layed out like this...
> 
> /cvs/proj/src/rs232/rs232.asm
> /cvs/proj/src/rs232/include/rs232_include.inc
> /cvs/proj/src/rs232/include/rs232.inc
> /cvs/proj/src/a2d/a2d.asm
> /cvs/proj/src/a2d/include/a2d_include.inc
> /cvs/proj/src/a2d/include/a2d.inc
> /cvs/proj/src/a2d/include/a2d_constants.inc
> /cvs/proj/src/servo/servo.asm
> /cvs/proj/src/servo/include/servo.inc
> /cvs/proj/src/servo/include/servo_constants.inc
> 
> What I want is the ability to create symlinks in another location so that it
> looks like this.
> 
> /code/rs232.asm
> /code/a2d.asm
> /code/servo.asm
> /code/include/rs232_include.inc
> /code/include/rs232.inc
> /code/include/a2d_include.inc
> /code/include/a2d.inc
> /code/include/a2d_constants.inc
> /code/include/servo.inc
> /code/include/servo_constants.inc
> 
> Where each file is a symlink to the original. I don't need someone to give
> me a script to do this (although that would be nice), but maybe just some
> guidance as to where to start looking. I think I could use something like
> find piped into a grep statement and then...that's where I get lost.
> 
> Anybody got any ideas? Thanks,
Hi,
my 2 cents
------------------------------------------------
A="/cvs/proj/src"
B="/code"
find "$A/" |while read line; do 
	X=$(echo "$line"|cut -d/ -f6-);
	ln -s "$line" "$B/$X"; 
done
------------------------------------------------
Kev
-- 
counter.li.org #238656 -- goto counter.li.org and be counted!
      `$'         $'         
       $          $                      _
 ,d$$$g$  ,d$$$b. $,d$$$b`$' g$$$$$b $,d$$b
,$P'  `$ ,$P' `Y$ $$'  `$ $  "'   `$ $$' `$
$$     $ $$ggggg$ $     $ $ ,$P""  $ $    $
`$g. ,$$ `$$._ _. $ _,g$P $ `$b. ,$$ $    $
 `Y$$P'$. `Y$$$$P $$$P"' ,$. `Y$$P'$ $.  ,$.

Attachment: signature.asc
Description: Digital signature


Reply to: