zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Shell scripting with zsh with unknown path
Date: Mon, 27 Jun 2011 09:51:40 -0700	[thread overview]
Message-ID: <110627095140.ZM12634@torch.brasslantern.com> (raw)
In-Reply-To: <r422Ps-1068i-9B5EB01499CF480697563A7E4C94112A@Air.local>

On Jun 27, 10:56am, TJ Luoma wrote:
} Subject: Shell scripting with zsh with unknown path
}
} The problem is that I don't always know where zsh will be 
} installed. It could be /usr/bin/zsh or /usr/local/bin/zsh or /bin/zsh.

There are several options here.  Among them:

(1) Write your zsh scripts so they can be autoloaded as shell functions,
and place them in directories in your $fpath.  This doesn't work if you
want to run your zsh scripts from other shells.

(2) Use a program to fix the #! line of all your scripts whenever you
install them on a new host.  E.g.

    perl -pi.orig -e 's@^(#!)/.*?/zsh\b@$1$ENV{SHELL}@; last' ...

where "..." is some pattern that matches your script files.

} I have seen perl scripts which have used
} 
}      #!/usr/bin/env perl
} 
} but that did not seem to work for zsh.

I know others here have successfully used this, though it does cause
some complications (can't pass -f to zsh, for example).


  reply	other threads:[~2011-06-27 16:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-27 14:56 TJ Luoma
2011-06-27 16:51 ` Bart Schaefer [this message]
2011-06-28  0:44 ` Vincent Lefevre

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=110627095140.ZM12634@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /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).