* Re: maintaining init files on a [t]csh influenced system [not found] <28279.199509061833@stone.dcs.warwick.ac.uk> @ 1995-09-06 19:00 ` Barton E. Schaefer 1995-09-07 5:38 ` Dave Sainty 0 siblings, 1 reply; 8+ messages in thread From: Barton E. Schaefer @ 1995-09-06 19:00 UTC (permalink / raw) To: Zefram; +Cc: zsh-users On Sep 6, 7:33pm, Zefram wrote: } Subject: Re: maintaining init files on a [t]csh influenced system } } >On the original question, though -- there are two major syntactic barriers } >to getting zsh to parse csh script files: } > } >1. "set" commands, because they can do any of: } > a. assign to multiple boolean options in a single command } > b. mix assignments of option variables with string assignments } > c. use spaces around the "=" sign in any string assignment } > } > set noclobber history = 50 nonomatch prompt="`hostname`: " } > } >2. the "$?variable" syntax for testing whether a variable is set } > } >You can get zsh to parse just about everything else (*) by clever use of } >aliases and zsh functions, but I haven't figured out a workaround for } >either of the above. } } $?variable would have to be supported by zsh itself, and would conflict } with the normal use of $?. Yup. } I think you could define a set function } that would do everything required, though. (Check if argument is an } option and set it if so, check for separated = signs and join together } arguments as required. It's actually not too difficult to write.) I suspect that if you wrote it, I could break it using something that would be legal csh syntax. I do agree that you can cover most of the common cases. Oh, I thought of a third serious syntax problem: History syntax in aliases. I shouldn't have forgotten that one, it's even mentioned in the section that I contributed to the FAQ. :-} } >(*) "switch" statements are VERY entertaining, but possible (I think); } > anybody care to guess how? } } Please enlighten us. It starts out with something like: alias switch='cat >! /tmp/sw$$ <<\endsw ; doswitch' And finishes up with a doswitch() function that reads the temporary file and looks for the case ... breaksw block matching the function params. -- Bart Schaefer Vice President, Technology, Z-Code Software schaefer@z-code.com Division of NCD Software Corporation http://www.well.com/www/barts ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: maintaining init files on a [t]csh influenced system 1995-09-06 19:00 ` maintaining init files on a [t]csh influenced system Barton E. Schaefer @ 1995-09-07 5:38 ` Dave Sainty [not found] ` <z-code!Comp.VUW.AC.NZ!David.Sainty> 0 siblings, 1 reply; 8+ messages in thread From: Dave Sainty @ 1995-09-07 5:38 UTC (permalink / raw) To: zsh-users Barton E. Schaefer writes: > > alias switch='cat >! /tmp/sw$$ <<\endsw ; doswitch' > > And finishes up with a doswitch() function that reads the temporary file > and looks for the case ... breaksw block matching the function params. Expensive every time you log in! As far as init files are concerned, how about a function doinitfiles() that did a [[ /etc/csh.cshrc -nt $HOME/.zsh.cshrc ]]. If true, run a conversion (autoloaded!) over /etc/csh.cshrc and save the result as .zsh.cshrc, in either case sourcing the new file. It's gotta be useful for people running zsh on un-zsh-savvy systems! So, who wants to write it? D. ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <z-code!Comp.VUW.AC.NZ!David.Sainty>]
* Re: maintaining init files on a [t]csh influenced system [not found] ` <z-code!Comp.VUW.AC.NZ!David.Sainty> @ 1995-09-07 8:17 ` Bart Schaefer 0 siblings, 0 replies; 8+ messages in thread From: Bart Schaefer @ 1995-09-07 8:17 UTC (permalink / raw) To: zsh-users On Sep 7, 5:38pm, Dave Sainty wrote: } Subject: Re: maintaining init files on a [t]csh influenced system } } Barton E. Schaefer writes: } } > alias switch='cat >! /tmp/sw$$ <<\endsw ; doswitch' } } Expensive every time you log in! Yeah, it fits more in the Stupid Zsh Tricks category. You'll have noticed from my earlier message that I don't do any such thing in my own startup files. } As far as init files are concerned, how about a function doinitfiles() } that did a [[ /etc/csh.cshrc -nt $HOME/.zsh.cshrc ]]. If true, run a } conversion (autoloaded!) over /etc/csh.cshrc and save the result as } .zsh.cshrc, in either case sourcing the new file. You could start with the c2z script that comes with the zsh dist. That converter needs updating -- it was written for zsh2.3 -- but it still does most of the right things. -- Bart Schaefer Vice President, Technology schaefer@z-code.com Z-Code / NCD Software Inc. What quantity of engineers is required to rotationally reconfigure an electronically-actuated filament-enabled photon-wave generator? ^ permalink raw reply [flat|nested] 8+ messages in thread
* maintaining init files on a [t]csh influenced system @ 1995-09-06 13:23 Andrew Eskilsson 1995-09-06 16:16 ` Toshi Isogai 0 siblings, 1 reply; 8+ messages in thread From: Andrew Eskilsson @ 1995-09-06 13:23 UTC (permalink / raw) To: zsh-users I am sitting on a normal SUN system, where all other people is using csh/tcsh. Now the problem is keeping my .zlogin and .zshrc file uptodate with the global cshrc and login files. Are there any possibilities to let zsh run the global files and incorporate the freshly set variables into the shell? Or are there any way of converting a login/cshrc file to "readable" (I want the comments too!) zlogin / zshrc At the moment I dump my environment i csh and convert the output to zsh and put it in my .zshrc file, loosing comments and so on. Not readable. /andy ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: maintaining init files on a [t]csh influenced system 1995-09-06 13:23 Andrew Eskilsson @ 1995-09-06 16:16 ` Toshi Isogai [not found] ` <toshi_isogai@maxtor.com> 0 siblings, 1 reply; 8+ messages in thread From: Toshi Isogai @ 1995-09-06 16:16 UTC (permalink / raw) To: zsh-users On Wed, 6 Sep 1995, Andrew Eskilsson wrote: > I am sitting on a normal SUN system, where all other people is using > csh/tcsh. Now the problem is keeping my .zlogin and .zshrc file > uptodate with the global cshrc and login files. > > Are there any possibilities to let zsh run the global files and > incorporate the freshly set variables into the shell? > I am in the same situation and what I did was setting my login shell back to csh and at the end of my .cshrc (or .login) I added exec zsh In this way, I can use all the environment variable from global cshrc. Toshi Isogai ^[$@0k3-MxL@^[(J ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <toshi_isogai@maxtor.com>]
* Re: maintaining init files on a [t]csh influenced system [not found] ` <toshi_isogai@maxtor.com> @ 1995-09-06 18:10 ` Barton E. Schaefer 1995-09-06 18:15 ` Zefram 1995-09-06 18:33 ` Zefram 0 siblings, 2 replies; 8+ messages in thread From: Barton E. Schaefer @ 1995-09-06 18:10 UTC (permalink / raw) To: zsh-users On Sep 6, 10:16am, Toshi Isogai wrote: } Subject: Re: maintaining init files on a [t]csh influenced system } } On Wed, 6 Sep 1995, Andrew Eskilsson wrote: } } > Are there any possibilities to let zsh run the global [csh] files and } > incorporate the freshly set variables into the shell? } } I am in the same situation and what I did was setting my login } shell back to csh and at the end of my .cshrc (or .login) I added } } exec zsh Yup, I do the same thing. Proper startup of the IRIX 4 desktop is pretty heavily wired into having csh (or sh) as your login shell. My .cshrc on IRIX 4 machines actually looks (in part) like this: ### # Figure out if this login is from XDM on the console setenv TTY "`tty`" if ($?DISPLAY) then if ($DISPLAY == :0) then if (! $?CONSOLE_LOGIN) then setenv CONSOLE_LOGIN "$TTY" endif endif setenv WINTERM xterm setenv XHOST `hostname` endif if ($?CONSOLE_LOGIN) then if ("$CONSOLE_LOGIN" != "$TTY") then unsetenv CONSOLE_LOGIN endif endif # If this is not the XDM console and is interactive, run zsh if (! $?CONSOLE_LOGIN && $?prompt) then if (! $?SHLVL) then exec /usr/local/bin/zsh -l else exec /usr/local/bin/zsh endif endif ### On the original question, though -- there are two major syntactic barriers to getting zsh to parse csh script files: 1. "set" commands, because they can do any of: a. assign to multiple boolean options in a single command b. mix assignments of option variables with string assignments c. use spaces around the "=" sign in any string assignment set noclobber history = 50 nonomatch prompt="`hostname`: " 2. the "$?variable" syntax for testing whether a variable is set You can get zsh to parse just about everything else (*) by clever use of aliases and zsh functions, but I haven't figured out a workaround for either of the above. (*) "switch" statements are VERY entertaining, but possible (I think); anybody care to guess how? -- Bart Schaefer Vice President, Technology, Z-Code Software schaefer@z-code.com Division of NCD Software Corporation http://www.well.com/www/barts ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: maintaining init files on a [t]csh influenced system 1995-09-06 18:10 ` Barton E. Schaefer @ 1995-09-06 18:15 ` Zefram 1995-09-06 18:33 ` Zefram 1 sibling, 0 replies; 8+ messages in thread From: Zefram @ 1995-09-06 18:15 UTC (permalink / raw) To: schaefer; +Cc: Z Shell users mailing list > >On Sep 6, 10:16am, Toshi Isogai wrote: >} Subject: Re: maintaining init files on a [t]csh influenced system >} >} On Wed, 6 Sep 1995, Andrew Eskilsson wrote: >} >} > Are there any possibilities to let zsh run the global [csh] files and >} > incorporate the freshly set variables into the shell? >} >} I am in the same situation and what I did was setting my login >} shell back to csh and at the end of my .cshrc (or .login) I added >} >} exec zsh > >Yup, I do the same thing. Proper startup of the IRIX 4 desktop is pretty >heavily wired into having csh (or sh) as your login shell. My .cshrc on >IRIX 4 machines actually looks (in part) like this: > >### > ># Figure out if this login is from XDM on the console >setenv TTY "`tty`" >if ($?DISPLAY) then > if ($DISPLAY == :0) then > if (! $?CONSOLE_LOGIN) then > setenv CONSOLE_LOGIN "$TTY" > endif > endif > setenv WINTERM xterm > setenv XHOST `hostname` >endif >if ($?CONSOLE_LOGIN) then > if ("$CONSOLE_LOGIN" != "$TTY") then > unsetenv CONSOLE_LOGIN > endif >endif > ># If this is not the XDM console and is interactive, run zsh >if (! $?CONSOLE_LOGIN && $?prompt) then > if (! $?SHLVL) then > exec /usr/local/bin/zsh -l > else > exec /usr/local/bin/zsh > endif >endif > >### > >On the original question, though -- there are two major syntactic barriers >to getting zsh to parse csh script files: > >1. "set" commands, because they can do any of: > a. assign to multiple boolean options in a single command > b. mix assignments of option variables with string assignments > c. use spaces around the "=" sign in any string assignment > > set noclobber history = 50 nonomatch prompt="`hostname`: " > >2. the "$?variable" syntax for testing whether a variable is set > >You can get zsh to parse just about everything else (*) by clever use of >aliases and zsh functions, but I haven't figured out a workaround for >either of the above. > >(*) "switch" statements are VERY entertaining, but possible (I think); > anybody care to guess how? > >-- >Bart Schaefer Vice President, Technology, Z-Code Software >schaefer@z-code.com Division of NCD Software Corporation >http://www.well.com/www/barts > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: maintaining init files on a [t]csh influenced system 1995-09-06 18:10 ` Barton E. Schaefer 1995-09-06 18:15 ` Zefram @ 1995-09-06 18:33 ` Zefram 1 sibling, 0 replies; 8+ messages in thread From: Zefram @ 1995-09-06 18:33 UTC (permalink / raw) To: schaefer [Sorry about the earlier version of this message. I goofed.] >On the original question, though -- there are two major syntactic barriers >to getting zsh to parse csh script files: > >1. "set" commands, because they can do any of: > a. assign to multiple boolean options in a single command > b. mix assignments of option variables with string assignments > c. use spaces around the "=" sign in any string assignment > > set noclobber history = 50 nonomatch prompt="`hostname`: " > >2. the "$?variable" syntax for testing whether a variable is set > >You can get zsh to parse just about everything else (*) by clever use of >aliases and zsh functions, but I haven't figured out a workaround for >either of the above. $?variable would have to be supported by zsh itself, and would conflict with the normal use of $?. I think you could define a set function that would do everything required, though. (Check if argument is an option and set it if so, check for separated = signs and join together arguments as required. It's actually not too difficult to write.) >(*) "switch" statements are VERY entertaining, but possible (I think); > anybody care to guess how? Please enlighten us. -zefram ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~1995-09-07 8:45 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <28279.199509061833@stone.dcs.warwick.ac.uk> 1995-09-06 19:00 ` maintaining init files on a [t]csh influenced system Barton E. Schaefer 1995-09-07 5:38 ` Dave Sainty [not found] ` <z-code!Comp.VUW.AC.NZ!David.Sainty> 1995-09-07 8:17 ` Bart Schaefer 1995-09-06 13:23 Andrew Eskilsson 1995-09-06 16:16 ` Toshi Isogai [not found] ` <toshi_isogai@maxtor.com> 1995-09-06 18:10 ` Barton E. Schaefer 1995-09-06 18:15 ` Zefram 1995-09-06 18:33 ` Zefram
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).