Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: script within find
- X-seq: zsh-users 11217
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Alexy Khrabrov <deliverable@xxxxxxxxx>
- Subject: Re: script within find
- Date: Sat, 24 Feb 2007 10:08:10 +0000
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <7c737f300702232339keaffa58g99b1f51de74e0c8a@xxxxxxxxxxxxxx>
- Mail-followup-to: Alexy Khrabrov <deliverable@xxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <7c737f300702232339keaffa58g99b1f51de74e0c8a@xxxxxxxxxxxxxx>
- Sender: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
On Fri, Feb 23, 2007 at 11:39:40PM -0800, Alexy Khrabrov wrote:
> Here's a mystery solving which I've avoided for a while. Now that I'm
> going to publish a recipe for fixing Photoshop installation on a
> case-sensitive Mac drive, I'd like to compress it into one script.
>
> The problem is, the script contains a find command, which passes all
> things it finds via -exec to a small helper script. The helper script
> is necessary since it seems difficult to make -exec contain a single
> in-line command to do it. Here they are:
>
> -- the find command:
>
> find . -name a -exec ~/bin/fix-ps-cs2.sh {} \;
>
> -- the helper script, ~/bin/fix-ps-cs2.sh:
>
> #!/bin/sh
> DIR=`dirname $1`
> (cd $DIR; ln -s a A)
>
> as you see, it needs to invoke dirname on the argument, then create a
> symlink in that dirname.
>
> Can the helper script be avoided and all the work done within the
> single find command?
[...]
Not sure what that has to do with zsh, but on MAC OSX, I'd
expect find to have a -execdir:
find . -name a -execdir ln -s a A \;
Otherwise:
find . -name a -exec sh -c 'ln -s a "${1%a}A"' {} {} \;
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author