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

Re: variable containing the current command



On May 26,  6:50pm, Michael Barnes wrote:
} Subject: Re: variable containing the current command
}
} preexec () {
} 	word=$* 
} 	word=$word[(w)0] 
} 	case $word in
} 		cd*|ls*)  ;;
} 		*) print -Pn "\e]2;%n@%m $word \a" ;;
} 	esac
} }
} 
} for some reason $1 does not get set properly under 3.0.5 extended so I
} manually parse it out from $*, dunno about newer versions.

I'm not sure why you say $1 does not get set properly.  $1 gets set to
the entire command line, which is exactly how it's documented:

`preexec'
     Executed just after a command has been read and is about to be
     executed.  If the history mechanism is active, the string to be
     executed is passed as an argument.             ^^^^!!!!!!^^^^^^
     ^^^^^^^^^^^^^^^^^^^^^^!!^^^^^^^^^

Is that in fact what you see, or is there a bug that I can't reproduce?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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