Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Perl like select()?



On Wed, 25 Aug 1999, Zefram wrote:

> Josh Howard wrote:
> >Is there any way, in a script, to use a "Perl-like" select() to
> >associate stdout with a particular file, before the execution of the
> >rest of the script?
> 
> 	exec > file
> 
> permanently redirects stdout.  Any redirection can be used this way.

This works in /bin/sh here, but not under zsh (I've tried
zsh-3.0.{0,5,6}), and I've always thought that it was a feature of zsh
that it didn't.

Example...

alpha2----~/tmp% { exec >foo
cursh> echo bar
cursh> }
zsh: command name expected
bar
alpha2----~/tmp% ls -l foo
-rw-r--r--   1 oma1000  colloids       0 Aug 25 17:46 foo

So I guess that there is something odd with my setup.  Does anybody
have any ideas?  Just to start you off, these are the options that I am
setting...

alpha2----~/tmp% grep setop ~/.zshrc
compctl -o setopt unsetopt isset
#unsetopt AUTO_LIST
unsetopt BEEP               # Don't beep ever.
setopt AUTO_LIST            # Auto list ambiguous choices.
#setopt AUTO_MENU            # Use menu completion for 2nd request.
unsetopt MENU_COMPLETE      # Don't use menu completion for 1st request.
setopt ALWAYS_LAST_PROMPT   # List completions after the prompt.
setopt AUTO_NAME_DIRS       # ~dirname instead of absolute names.
setopt EXTENDED_GLOB        # Extended filename globbing.
setopt NO_CLOBBER           # Don't clobber files with >, or create with >>.
setopt LIST_TYPES           # Completions get a trailing id symbol.
setopt INTERACTIVE_COMMENTS # Allow comments in interactive shells.
unsetopt NOTIFY             # Wait before reporting status of background jobs.
unsetopt BG_NICE            # Don't run background jobs at a lower priority.
setopt IGNORE_EOF           # Don't exit on EOF.
setopt MULTIOS              # Glob after redirection operator.
setopt AUTO_PUSHD
setopt PUSHD_IGNORE_DUPS
setopt PUSHD_SILENT PUSHD_TO_HOME PUSHD_MINUS
setopt HIST_IGNORE_DUPS APPEND_HISTORY

Owen




Messages sorted by: Reverse Date, Date, Thread, Author