You're viewing a comment by libdave and its responses.

April 22, 2010, 12:01

One of my favorites: to edit any env variable

print -s "PATH=$PATH"

then edit the last command (zsh with vi keybindings): ESC-

Comment Responses

April 22, 2010, 12:08

Almost forgot the follow up function to make it easier:
eval "print -s ${1?no variable}=\'\$$1\'"

then do this:
X='xyzzy plugh'

foo X

then edit your history

April 22, 2010, 23:06

Hmm.. Can you explain this a bit more? I don't understand it.

May 19, 2010, 13:21

What he's doing is first he sets PATH to itself (eval PATH=$PATH), which leaves him with something like
in his history. Then he just uses the editor to modify this and run it again, thus setting PATH to the modified value.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "linux_212": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.