Re: exec script in all subdirs; pathnames contain spaces
- From: Stephane CHAZELAS <this.address@xxxxxxxxxx>
- Date: Thu, 22 Feb 2007 08:20:40 GMT
2007-02-21, 15:55(-06), Charles Russell:
[...]
find . -exec sh -c '
unset CDPATH
cd -P "$1" && shift && exec "$@"' inline {} "$@" \;
Sorry, that was not a Bourne shell script. But do you really
need a Bourne shell script? The Bourne shell was common 15 years
ago, but not so much today, and it's not standard as per the new
Unix.
Close enough. It runs on cygwin's ash shell, which is what I normally
use for scripts. The main idea was to be as portable as possible.
I haven't the foggiest notion how your script works, though. Could you
give me some clues where to look for documentation on "inline"? I can't
find it in ash, bash, or find. And what does the final "-" do on line 1
(starting with #!)?
Inline is a "dummy" parameter. You can use anything there.
That parameter will become the inline-script's (the argument to
-c) $0 in POSIX shells.
find . -exec sh -c '
unset CDPATH
cd -P "$0" && exec "$@"' {} "$@" \;
would have been even simpler. It's just that $0 usually contains
the script name, so for inline scripts, I tend to use "inline".
--
Stéphane
.
- References:
- exec script in all subdirs; pathnames contain spaces
- From: Charles Russell
- Re: exec script in all subdirs; pathnames contain spaces
- From: Stephane CHAZELAS
- Re: exec script in all subdirs; pathnames contain spaces
- From: Stephane CHAZELAS
- Re: exec script in all subdirs; pathnames contain spaces
- From: Charles Russell
- exec script in all subdirs; pathnames contain spaces
- Prev by Date: Help: Add variable to $PATH
- Next by Date: Re: Help: Add variable to $PATH
- Previous by thread: Re: exec script in all subdirs; pathnames contain spaces
- Next by thread: Re: exec script in all subdirs; pathnames contain spaces
- Index(es):
Relevant Pages
|