|
|
Subscribe / Log in / New account

New features in the fish shell

New features in the fish shell

Posted Sep 30, 2020 13:42 UTC (Wed) by Paf (subscriber, #91811)
In reply to: New features in the fish shell by flussence
Parent article: New features in the fish shell

May I ask why? I dislike the feature and am glad I now know how to turn it off. I’m curious what use people have for it.


to post comments

New features in the fish shell

Posted Sep 30, 2020 14:09 UTC (Wed) by randomguy3 (subscriber, #71063) [Link] (1 responses)

For me, I don't use the history suppression very often, but occasionally I want to use a command that requires, say, passing a password as an argument (not ideal, but sometimes unavoidable), or something that will pollute history searches (which I make heavy use of). A leading space is something I rarely do accidentally, but is easy to do and easy to remember when I want it.

New features in the fish shell

Posted Sep 30, 2020 20:38 UTC (Wed) by mathstuf (subscriber, #69389) [Link]

My pattern for this is to put the token/password in a variable whose assignment is hidden in the history with the leading space. The command itself is usually of value in the history.

New features in the fish shell

Posted Sep 30, 2020 20:06 UTC (Wed) by szm (subscriber, #100120) [Link] (3 responses)

In addition to the sensitive information / password use-case already mentioned, I've picked up the habit of excluding potentially catastrophic and destructive commands like, let's say,

rm -rf ./*

or dropping database tables, etc. from the search history. Before learning about history suppression in my younger years (i.e. back when I tended to be prone to getting nervous during an incident with a critical system or when I sometimes would grow impatient while working over high-latency ssh connections), I've had several jump-scares when, by "typing ahead" not only commands but retrieving items from the history with the arrow keys, found that I accidentially ended up with the "interesting side-effects if run here and now" kind of command. Luckily always before hitting enter, but still.

It's not a fool-proof system, but I find it quite useful in the "better safe than sorry" kind of way.

Cheers,
szm

New features in the fish shell

Posted Oct 1, 2020 0:02 UTC (Thu) by Paf (subscriber, #91811) [Link]

Interesting, thanks!

New features in the fish shell

Posted Oct 3, 2020 6:44 UTC (Sat) by marcH (subscriber, #57642) [Link] (1 responses)

> rm -rf ./*

Agreed 200%: I recalled by mistake commands like these from my (crazy long) bash history once or twice and now I'm trying hard to never let them get there in the first place.

Another trick I use (better safe twice than sorry) is this:

rm -rf ../current_directory/*

With completion it takes barely longer to type and it greatly reduces the chances of that command doing anything if recalled by accident.

Finally, there is of course:

mv * ~/Trash/

Only the last one would probably have stopped me from recursively deleting the target of a symbolic link while thinking I was just deleting the link itself...

New features in the fish shell

Posted Oct 3, 2020 17:51 UTC (Sat) by jo42 (subscriber, #59640) [Link]

Zsh has the helpful feature to filter history entries. Defining the function zshaddhistory to stop some commands going into the history file:

zshaddhistory()
{
# Don't save run-help and kill commands and commands run in bad-stuff
[[ $1 != (run-help *|kill *|bg|fg|cd|reboot|halt) && $PWD != $HOME/bad-stuff/* ]]
}

New features in the fish shell

Posted Oct 3, 2020 6:46 UTC (Sat) by marcH (subscriber, #57642) [Link]

> May I ask why? I dislike the feature and am glad I now know how to turn it off. I’m curious what use people have for it.

You could start by explaining why you dislike the feature, I'm curious :-) Lots of copy/paste?


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds