On Jan 13, 2008 8:50 AM, Philip Ganchev <[EMAIL PROTECTED]> wrote: > On Jan 11, 2008 6:34 PM, Isaac Dupree <[EMAIL PROTECTED]> wrote: > > > > >> But just doing nothing when I type "sudo !!" is not very friendly. At > > >> the > > >> least, it should pop up a message telling me the "fish way" to do it. > > > > > > This is about as complicated as fully implementing "!!". > > > > code complexity, user simplicity: it's a tradeoff, right? > > Not exactly. This is one example of a user habit that is actually > inefficient. It's fine for the special cases of "!!", "!$" and "!^", > but in general editing using Bash's substitution mechanism is a > needless mental burden and a risk. > > > [...] However, if > > '!!' was a command name then sudo !! would make sense in fish without > > special character interpretation, so just giving a message for !! would > > complain about some correct cases ( ` the backtick is also treated as an > > ordinary character in this silent way, I've noticed, which would have no > > troubles whatsoever if there weren't these habits from other shells). > > How about: > > function !! > eval (echo $history[2]) > end > > By the way, I get this behavior with Fish 1.22.1, is it expected? > > > function h1; tail -n 1 ~/.config/fish/fish_history; end > > echo -n > > h1 > function h1; tail -n 1 ~/.config/fish/fish_history; end
Yes, more or less. The fish_history file is not updated all the time. And even if it was, if you're running multiple shells, the last entry might be from one of the other fish shells running. Use the $history variable to access the command history programatically. Axel > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > Fish-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/fish-users > ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
