* shebang consistency @ 2007-12-12 23:31 Clint Adams 2007-12-13 4:13 ` Bart Schaefer 0 siblings, 1 reply; 6+ messages in thread From: Clint Adams @ 2007-12-12 23:31 UTC (permalink / raw) To: zsh-workers Could we standardize on a single line so as to shorten the regex in my s/// ? Functions/Calendar/calendar_add:#!/bin/env zsh Functions/Example/cat:#! /usr/local/bin/zsh -f Functions/Example/zless:#!/usr/bin/zsh -f Functions/Misc/zkbd:#! /bin/zsh -f Functions/Misc/zcalc:#!/usr/local/bin/zsh -i Functions/Misc/checkmail:#! /usr/local/bin/zsh Functions/Misc/run-help:#!/usr/local/bin/zsh ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shebang consistency 2007-12-12 23:31 shebang consistency Clint Adams @ 2007-12-13 4:13 ` Bart Schaefer 2007-12-13 4:38 ` Clint Adams 0 siblings, 1 reply; 6+ messages in thread From: Bart Schaefer @ 2007-12-13 4:13 UTC (permalink / raw) To: zsh-workers On Dec 12, 6:31pm, Clint Adams wrote: } } Could we standardize on a single line so as to shorten the regex } in my s/// ? Well ... #!/bin/env zsh does not permit the possibility of adding the -f option, so it's out. Any other string needs to be edited to insert the local path to the zsh binary, so for files that really are scripts it doesn't matter what we start with, it'll be wrong as often as right. I presume your s/// is doing what I'd otherwise suggest, which is that "make install" fix up the #! line(s) when copying the files into place. At that point it should be able to determine what the correct install path for the binary would be. (Why doesn't s:^#!.*[^ /]zsh:#!/bin/zsh: do the trick? How much shorter do you need to get?) I guess I'd suggest standardizing on "#!/bin/zsh" plus options. } Functions/Calendar/calendar_add:#!/bin/env zsh } Functions/Example/cat:#! /usr/local/bin/zsh -f } Functions/Example/zless:#!/usr/bin/zsh -f } Functions/Misc/zkbd:#! /bin/zsh -f } Functions/Misc/zcalc:#!/usr/local/bin/zsh -i } Functions/Misc/checkmail:#! /usr/local/bin/zsh } Functions/Misc/run-help:#!/usr/local/bin/zsh Most of the files in Functions/ are not intended to be run as scripts in any case, so the only reason for the #! line is so that clever editors like vim and emacs can activate the correct syntax mode ... ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shebang consistency 2007-12-13 4:13 ` Bart Schaefer @ 2007-12-13 4:38 ` Clint Adams 2007-12-13 7:53 ` Stephane Chazelas 2007-12-13 21:12 ` Peter Stephenson 0 siblings, 2 replies; 6+ messages in thread From: Clint Adams @ 2007-12-13 4:38 UTC (permalink / raw) To: zsh-workers On Wed, Dec 12, 2007 at 08:13:39PM -0800, Bart Schaefer wrote: > (Why doesn't s:^#!.*[^ /]zsh:#!/bin/zsh: do the trick? How much shorter > do you need to get?) Probably that out-of-place caret. I wasn't handling the env case, (and I don't have env in /bin), so I was thinking it would be nice to just have a single string to match. > I guess I'd suggest standardizing on "#!/bin/zsh" plus options. Works for me. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shebang consistency 2007-12-13 4:38 ` Clint Adams @ 2007-12-13 7:53 ` Stephane Chazelas 2007-12-13 21:12 ` Peter Stephenson 1 sibling, 0 replies; 6+ messages in thread From: Stephane Chazelas @ 2007-12-13 7:53 UTC (permalink / raw) To: zsh-workers On Wed, Dec 12, 2007 at 11:38:06PM -0500, Clint Adams wrote: > On Wed, Dec 12, 2007 at 08:13:39PM -0800, Bart Schaefer wrote: > > (Why doesn't s:^#!.*[^ /]zsh:#!/bin/zsh: do the trick? How much shorter > > do you need to get?) > > Probably that out-of-place caret. I wasn't handling the env case, > (and I don't have env in /bin), so I was thinking it would be nice to just > have a single string to match. env seems to consistently be in /usr/bin. I think there are very few exceptions to that accross unices. To make the change only on the first line: sed -e '1!b' -e 's:^#![[:blank:]]*[^[:blank:]]*zsh:#! /bin/zsh:' > > I guess I'd suggest standardizing on "#!/bin/zsh" plus options. > > Works for me. I like: #! /bin/zsh -- better meself, not that it makes a lot of difference, except to the eye and for the double-click-copy-paste or vi's W/E motions. -- Stephane ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shebang consistency 2007-12-13 4:38 ` Clint Adams 2007-12-13 7:53 ` Stephane Chazelas @ 2007-12-13 21:12 ` Peter Stephenson 2007-12-13 22:12 ` Clint Adams 1 sibling, 1 reply; 6+ messages in thread From: Peter Stephenson @ 2007-12-13 21:12 UTC (permalink / raw) To: zsh-workers On Wed, 12 Dec 2007 23:38:06 -0500 Clint Adams <clint@zsh.org> wrote: > > I guess I'd suggest standardizing on "#!/bin/zsh" plus options. > > Works for me. Go ahead if you like, with or without the space. pws ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shebang consistency 2007-12-13 21:12 ` Peter Stephenson @ 2007-12-13 22:12 ` Clint Adams 0 siblings, 0 replies; 6+ messages in thread From: Clint Adams @ 2007-12-13 22:12 UTC (permalink / raw) To: zsh-workers On Thu, Dec 13, 2007 at 09:12:13PM +0000, Peter Stephenson wrote: > Go ahead if you like, with or without the space. Index: Functions/Calendar/calendar_add =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Calendar/calendar_add,v retrieving revision 1.5 diff -u -r1.5 calendar_add --- Functions/Calendar/calendar_add 29 Nov 2007 09:49:43 -0000 1.5 +++ Functions/Calendar/calendar_add 13 Dec 2007 22:08:17 -0000 @@ -1,4 +1,4 @@ -#!/bin/env zsh +#!/bin/zsh # All arguments are joined with spaces and inserted into the calendar # file at the appropriate point. Index: Functions/Example/cat =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Example/cat,v retrieving revision 1.1 diff -u -r1.1 cat --- Functions/Example/cat 2 Apr 2001 12:24:08 -0000 1.1 +++ Functions/Example/cat 13 Dec 2007 22:08:17 -0000 @@ -1,4 +1,4 @@ -#! /usr/local/bin/zsh -f +#!/bin/zsh -f local file Index: Functions/Example/zless =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Example/zless,v retrieving revision 1.1 diff -u -r1.1 zless --- Functions/Example/zless 2 Apr 2001 12:28:48 -0000 1.1 +++ Functions/Example/zless 13 Dec 2007 22:08:17 -0000 @@ -1,4 +1,4 @@ -#!/usr/bin/zsh -f +#!/bin/zsh -f # # zsh function script to run less on various inputs, decompressing as required. # Author: Phil Pennock. zsh-hacks@athenaeum.demon.co.uk Index: Functions/Misc/checkmail =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Misc/checkmail,v retrieving revision 1.5 diff -u -r1.5 checkmail --- Functions/Misc/checkmail 15 Sep 2006 18:22:19 -0000 1.5 +++ Functions/Misc/checkmail 13 Dec 2007 22:08:17 -0000 @@ -1,4 +1,4 @@ -#! /usr/local/bin/zsh +#!/bin/zsh # # This autoloadable function checks the folders specified as arguments # for new mails. The arguments are interpreted in exactly the same way Index: Functions/Misc/run-help =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Misc/run-help,v retrieving revision 1.6 diff -u -r1.6 run-help --- Functions/Misc/run-help 15 Oct 2006 17:30:13 -0000 1.6 +++ Functions/Misc/run-help 13 Dec 2007 22:08:17 -0000 @@ -1,4 +1,4 @@ -#!/usr/local/bin/zsh +#!/bin/zsh # # Figure out where to get the best help, and get it. # Index: Functions/Misc/zcalc =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Misc/zcalc,v retrieving revision 1.14 diff -u -r1.14 zcalc --- Functions/Misc/zcalc 19 Apr 2006 16:09:07 -0000 1.14 +++ Functions/Misc/zcalc 13 Dec 2007 22:08:17 -0000 @@ -1,4 +1,4 @@ -#!/usr/local/bin/zsh -i +#!/bin/zsh -i # # Zsh calculator. Understands most ordinary arithmetic expressions. # Line editing and history are available. A blank line or `q' quits. Index: Functions/Misc/zkbd =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Misc/zkbd,v retrieving revision 1.4 diff -u -r1.4 zkbd --- Functions/Misc/zkbd 26 Feb 2007 07:44:10 -0000 1.4 +++ Functions/Misc/zkbd 13 Dec 2007 22:08:18 -0000 @@ -1,4 +1,4 @@ -#! /bin/zsh -f +#!/bin/zsh -f [[ -o interactive ]] && { local -i ARGC ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-12-13 22:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-12-12 23:31 shebang consistency Clint Adams 2007-12-13 4:13 ` Bart Schaefer 2007-12-13 4:38 ` Clint Adams 2007-12-13 7:53 ` Stephane Chazelas 2007-12-13 21:12 ` Peter Stephenson 2007-12-13 22:12 ` Clint Adams
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).