Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Oct 2005 16:04:45 -0700
From:      Drew Tomlinson <drew@mykitchentable.net>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   sh Scripting - String Manipulation
Message-ID:  <434EE80D.2010103@mykitchentable.net>

next in thread | raw e-mail | index | archive | help
I'm working on a script that reads a directory using 'find' and its 
'-exec' primary to create a symlink to the file.  So for example, I have 
the following command:

find /multimedia/Pictures -iname "*.jpg" -print

This command returns a bunch of filenames.  Here's an example of one:

/multimedia/Pictures/2005 Kimberly & Rich/IMG_1210.JPG

What I'd like to is get '-exec' to run this command:

ln -s "/multimedia/Pictures/2005 Kimberly & Rich/IMG_1210.JPG" "2005 
Kimberly & Rich/IMG_1210.JPG"

What is the best way to manipulate this string?  And then what is the 
right syntax for -exec?  I'm an extreme newbie when it comes to shell 
scripting.  Will this work?  Are the better ways to do this than using 
"find".

Thanks for your help,

Drew

-- 
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books, & More!

http://www.alchemistswarehouse.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?434EE80D.2010103>