Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
'print -s' in a function
- X-seq: zsh-users 221
- From: Huy Le <huyle@xxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxxx
- Subject: 'print -s' in a function
- Date: Sun, 26 May 1996 05:19:20 -0700
VERSION: zsh2.6beta13
So, I'm trying the following:
function fed() {
# Allows for the editing of functions in memory
if [[$# -ne 1]]; then
echo "usage: $0 function"
return 1
fi
local i
if autoload | grep " $1 " >/dev/null 2>&1; then
for i in "$fpath[@]"; do
if [[-f $fpath[1]/$1]]; then
eval "`echo \"function $1() {\"; <$fpath[1]/$1;
echo \}`"
break
fi
done
fi
builtin print -s "function `which $1`"
fc
# Replace the previous line with the next line to see what's intended
#builtin print -z fc
}
If you try running this, such as running:
fed fed
you'll notice that what shows up in your editor
is "fed fed" instead of the contents of fed.
The problem is that the history doesn't get updated right
away after the 'print -s' line. Why? Could this be a bug?
- Huy
Messages sorted by:
Reverse Date,
Date,
Thread,
Author