From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Clint Olsen <olsenc@ichips.intel.com>, zsh-workers@sunsite.auc.dk
Subject: Re: #!/path/to/arch-indep/zsh -f
Date: Thu, 23 Sep 1999 16:42:49 +0000 [thread overview]
Message-ID: <990923164249.ZM27135@candle.brasslantern.com> (raw)
In-Reply-To: <19990922093920.A24958@ichips.intel.com>
On Sep 22, 9:39am, Clint Olsen wrote:
} Subject: Re: #!/path/to/arch-indep/zsh -f
}
} On this crappy system (AIX 4.1.X), it must be the multiple level of
} indirection problem that Bart mentioned. [...] Bummer... Compiling
} a wrapper program again defeats the purpose of having an
} architecture-independent launch point.
Two remarks:
(1) This is what autoloadable shell functions are for. If an already-
running zsh loads and executes the function, it can't possibly be the
wrong architecture.
(2) What you're really asking for is not an arch-indep launch point, but
an arch-dependent path to the shell. You can still have that, you just
have to do your launching a slightly different way.
Here's what you do: Take your launcher script and fix it to pass along
a modified $0 file name to zsh, like so:
#!/bin/sh
if [ -x $OTOOLS/bin/$OS/zsh ]; then
exec $OTOOLS/bin/$OS/zsh "$0".real "$@"
else
exec /usr/intel/bin/zsh "$0".real "$@"
fi
(Remember, you're in sh, not zsh, so $* does word-splitting; use "$@". If
you're really paranoid, use ${1+"$@"} [some old sh turn "$@" into an empty
string if there are no arguments at all, rather than into nothing].)
Put that in ~/bin (or wherever your scripts are) and call it "launch-zsh"
or some such.
Now, for every script that you want to be able to launch this way, run
mv $script $script.real && ln $script launch-zsh
If you don't like the ".real" extension on every file name, put the real
script in some other directory and do a more complicated replacement on
$0 in the launcher.
It's not as clean as what you originally thought of, but it'll work. You
can even get as clever as you like with the launcher:
#!/bin/sh
ZERO=$0.real
if [ -f $ZERO ]; then
read scratch command switches < "$ZERO"
case "$scratch" in
'#!') ;;
'#!*') switches="$command"; command="$scratch";;
*) echo 1>&2 "$0": warning: no '#!' line in "$ZERO";;
esac
case "$command" in
*/zsh)
if [ -x $OTOOLS/bin/$OS/zsh ]; then
exec $OTOOLS/bin/$OS/zsh "$switches" "$ZERO" "$@"
else
exec /usr/intel/bin/zsh "$switches" "$ZERO" "$@"
fi;;
*) echo 1>&2 "$0": "$command" is not zsh; exit 1;;
esac
else
echo 1>&2 "$0": launcher found no real script
exit 1
fi
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
next prev parent reply other threads:[~1999-09-23 16:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-09-22 1:23 Clint Olsen
1999-09-22 7:59 ` Peter Stephenson
1999-09-22 8:58 ` Clint Olsen
1999-09-22 8:33 ` Peter Stephenson
1999-09-22 16:39 ` Clint Olsen
1999-09-23 16:42 ` Bart Schaefer [this message]
1999-09-22 9:13 ` Bart Schaefer
1999-09-22 11:24 ` Owen M. Astley
1999-09-22 16:28 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=990923164249.ZM27135@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=olsenc@ichips.intel.com \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).