Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Shell scripting with zsh with unknown path
- X-seq: zsh-users 16113
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Shell scripting with zsh with unknown path
- Date: Mon, 27 Jun 2011 09:51:40 -0700
- In-reply-to: <r422Ps-1068i-9B5EB01499CF480697563A7E4C94112A@Air.local>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <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).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author