Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: "script" trickery
- X-seq: zsh-users 11203
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: "script" trickery
- Date: Thu, 15 Feb 2007 20:01:23 -0800
- In-reply-to: <20070216.041058.75192333.Meino.Cramer@xxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070216.041058.75192333.Meino.Cramer@xxxxxx>
On Feb 16, 4:10am, Meino Christian Cramer wrote:
}
} I tried to write a shell function for my .zshrc which first checks
} for the existence of the given file and then starts script.
}
} But that fails due to the fact that "script" seems to start a subshel
} or do other trickery.
Well, yes, it starts a subshell, but that shouldn't prevent a function
in the calling shell from testing for the existence of the file before
script even gets started.
function script {
emulate -L zsh
setopt noclobber
zmodload -i zsh/zutil
local -a opts
zparseopts -D -a opts a c: f q t
set -- "${@:-typescript}"
if [[ -e $1 ]]; then
print -u2 script: file exists: $1
return 1
fi
command script $opts $*
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author