|
|
Subscribe / Log in / New account

New features in the fish shell

New features in the fish shell

Posted Oct 3, 2020 6:44 UTC (Sat) by marcH (subscriber, #57642)
In reply to: New features in the fish shell by szm
Parent article: New features in the fish shell

> 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...


to post comments

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/* ]]
}


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