fish-users Mailing List for The friendly interactive shell
Status: Beta
Brought to you by:
liljencrantz
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(21) |
Jul
(8) |
Aug
(93) |
Sep
(253) |
Oct
(119) |
Nov
(49) |
Dec
(214) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(123) |
Feb
(86) |
Mar
(35) |
Apr
(94) |
May
(61) |
Jun
(4) |
Jul
(25) |
Aug
(190) |
Sep
(187) |
Oct
(225) |
Nov
(47) |
Dec
(30) |
| 2007 |
Jan
(40) |
Feb
(27) |
Mar
(81) |
Apr
(29) |
May
(31) |
Jun
(17) |
Jul
(11) |
Aug
(32) |
Sep
(6) |
Oct
(60) |
Nov
(20) |
Dec
(4) |
| 2008 |
Jan
(169) |
Feb
(24) |
Mar
(13) |
Apr
(5) |
May
(31) |
Jun
(54) |
Jul
(8) |
Aug
(22) |
Sep
(12) |
Oct
(20) |
Nov
(14) |
Dec
(8) |
| 2009 |
Jan
(18) |
Feb
(116) |
Mar
(20) |
Apr
(15) |
May
(7) |
Jun
(23) |
Jul
(5) |
Aug
(36) |
Sep
(11) |
Oct
(17) |
Nov
|
Dec
(13) |
| 2010 |
Jan
(28) |
Feb
(12) |
Mar
(39) |
Apr
(93) |
May
(10) |
Jun
(15) |
Jul
(5) |
Aug
(16) |
Sep
(33) |
Oct
(38) |
Nov
(102) |
Dec
(94) |
| 2011 |
Jan
(54) |
Feb
(23) |
Mar
(14) |
Apr
(3) |
May
|
Jun
(5) |
Jul
(96) |
Aug
(14) |
Sep
(24) |
Oct
(9) |
Nov
(10) |
Dec
(1) |
| 2012 |
Jan
(17) |
Feb
(10) |
Mar
(21) |
Apr
(15) |
May
(47) |
Jun
(208) |
Jul
(49) |
Aug
(63) |
Sep
(37) |
Oct
(15) |
Nov
(42) |
Dec
(65) |
| 2013 |
Jan
(27) |
Feb
(10) |
Mar
(6) |
Apr
(50) |
May
(118) |
Jun
(43) |
Jul
(29) |
Aug
(37) |
Sep
(29) |
Oct
(20) |
Nov
(44) |
Dec
(40) |
| 2014 |
Jan
(37) |
Feb
(24) |
Mar
(31) |
Apr
(68) |
May
(14) |
Jun
(22) |
Jul
(20) |
Aug
(38) |
Sep
(29) |
Oct
(54) |
Nov
(83) |
Dec
(39) |
| 2015 |
Jan
(12) |
Feb
(16) |
Mar
(30) |
Apr
(40) |
May
(39) |
Jun
(14) |
Jul
(9) |
Aug
(56) |
Sep
(15) |
Oct
(12) |
Nov
(7) |
Dec
(56) |
| 2016 |
Jan
(27) |
Feb
(9) |
Mar
(27) |
Apr
(12) |
May
(20) |
Jun
(25) |
Jul
(19) |
Aug
(14) |
Sep
(13) |
Oct
(16) |
Nov
(38) |
Dec
(11) |
| 2017 |
Jan
(26) |
Feb
(13) |
Mar
(9) |
Apr
|
May
(10) |
Jun
(18) |
Jul
(11) |
Aug
(69) |
Sep
(62) |
Oct
(48) |
Nov
(18) |
Dec
(9) |
| 2018 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(14) |
Jun
(10) |
Jul
(2) |
Aug
(3) |
Sep
(5) |
Oct
(1) |
Nov
|
Dec
(6) |
| 2019 |
Jan
(6) |
Feb
(11) |
Mar
(23) |
Apr
(1) |
May
(10) |
Jun
(8) |
Jul
(4) |
Aug
(9) |
Sep
(7) |
Oct
(4) |
Nov
|
Dec
(5) |
| 2020 |
Jan
(9) |
Feb
(5) |
Mar
|
Apr
(3) |
May
(2) |
Jun
(8) |
Jul
(6) |
Aug
(13) |
Sep
(3) |
Oct
(8) |
Nov
(3) |
Dec
(4) |
| 2021 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(2) |
May
(10) |
Jun
|
Jul
(1) |
Aug
(7) |
Sep
|
Oct
(7) |
Nov
|
Dec
(3) |
| 2022 |
Jan
|
Feb
(5) |
Mar
(6) |
Apr
(4) |
May
(4) |
Jun
(1) |
Jul
(3) |
Aug
|
Sep
(5) |
Oct
(2) |
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(3) |
Mar
(5) |
Apr
(1) |
May
(3) |
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
(5) |
Dec
(4) |
| 2024 |
Jan
(4) |
Feb
(1) |
Mar
(4) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
(1) |
| 2025 |
Jan
(10) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
| 2026 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(11) |
Nov
|
Dec
|
|
From: Ralph S. <ra...@ml...> - 2026-10-04 13:54:21
|
* Matt Fellenz via Fish-users: > Something that might be nice in this case is an alias to easily run a > single bash command. That way you don't have to choose between fish or > bash. Bash is available on all machines I work with, because of Bash scripts being so ubiquitous. Even with fish as one's login shell, it seems simpler to me to enter an interactive Bash session than to come up with ways to pass uninterpreted-by-fish arguments to "bash -c mumble". > Not sure how that would work though, and if there is some way to > create an alias that receives its arguments verbatim [...] I think that, even if there were a "raw" version of $argv, calling a function from an interactive fish session would imply that arguments are subjected to globbing etc. before they are even passed to the function? That seems like quite a hurdle. Easier to just use: fish$ bash bash$ rm [b-k]* bash$ ^D fish$ ... resume normal operations ... Doing Bash things directly in Bash seems more reasonable to me than getting tricksy with passing arguments. My whole motivation for opening this thread was keeping things as simple as possible. -Ralph |
|
From: Matt F. <ma...@fe...> - 2026-10-04 12:53:26
|
> I agree, and I have already started my own collection of useful-to-me > fish scripts which I sync across machines. I am not dismissing fish's > abbreviations, functions, or custom scripts at all. This particular > example is just a case where Bash has the advantage. Something that might be nice in this case is an alias to easily run a single bash command. That way you don't have to choose between fish or bash. Not sure how that would work though, and if there is some way to create an alias that receives its arguments verbatim, i.e., without glob expansion and parameter substitution, so that you don't have to quote the command like `sh -c 'rm [b-k]*'`. |
|
From: Ralph S. <ra...@ml...> - 2026-10-04 11:07:33
|
* Myrddin Emrys: > [...] aliases, functions, and abbreviations are idiomatic fish in my > opinion. One of its best features is the flexible ways its syntax can > be extended. I agree, and I have already started my own collection of useful-to-me fish scripts which I sync across machines. I am not dismissing fish's abbreviations, functions, or custom scripts at all. This particular example is just a case where Bash has the advantage. Fish does many things as well as, or better than, other shells, which is why I have moved from Bash and Zsh to fish on every machine where circumstances allow it. I am also not complaining about fish at all. In this case, I'll just stick to what I have known for decades (like "awk" or "find"), because fish lacks a simpler, built-in approach. No harm, no foul. -Ralph |
|
From: Myrddin E. <my...@gm...> - 2026-10-04 02:54:45
|
That's fair, but aliases, functions, and abbreviations are idiomatic fish in my opinion. One of its best features is the flexible ways its syntax can be extended. If you don't want to use it you don't have to. I understand the desire to not be tied to customizations, especially if you tend to hop from box to box. But characterizing those extension mechanisms as 'external commands or scripts' is inaccurate, and dismissing them leaves some of the power of fish underutilized. On Sat, Oct 3, 2026 at 3:10 PM Ralph Seichter via Fish-users < fis...@li...> wrote: > * Myrddin Emrys: > > > function rmr [...] > > As I stated from the beginning, I want neither external commands nor > scripts. That's easy to do in various ways, as the suggestions posted > in this message thread demonstrate. > > I am explicitly (and only) looking for something idiomatic to fish, but > as brief and effortless as the Bash version of "rm [b-k]*". There is no > point in anything else, and apparently fish can't do it. > > -Ralph > > > _______________________________________________ > Fish-users mailing list > Fis...@li... > https://lists.sourceforge.net/lists/listinfo/fish-users > |
|
From: Ralph S. <ra...@ml...> - 2026-10-03 20:08:28
|
* Myrddin Emrys: > function rmr [...] As I stated from the beginning, I want neither external commands nor scripts. That's easy to do in various ways, as the suggestions posted in this message thread demonstrate. I am explicitly (and only) looking for something idiomatic to fish, but as brief and effortless as the Bash version of "rm [b-k]*". There is no point in anything else, and apparently fish can't do it. -Ralph |
|
From: Greg R. <gre...@um...> - 2026-10-03 19:21:49
|
On Sat, Oct 3, 2026, at 11:02 AM, Ralph Seichter via Fish-users wrote:
> Having read about wildcards (1) and fish for Bash users (2), I wonder
> about the fish equivalent of calling `rm [b-k]*` in a Bash session.
For a non-fish solution, which would work with any shell, use find:
find . -maxdepth 1 -iname '[b-k]*'
You can change "iname" to "name" to make it sensitive to case. You can add "-type f" if you want only regular files.
The find command can used with command substitution:
rm -iv (find . -maxdepth 1 -iname '[b-k]*') # works in fish
or by itself:
find . -maxdepth 1 -iname '[b-k]*' -execdir rm -iv '{}' '+'
|
|
From: Alex C. <cha...@gm...> - 2026-10-03 18:17:37
|
It's interesting why that many people insist on '.*$' to end their regexes; isn't it generally implied? '^[a-c].*' -> '^[a-c]' On Sat, Oct 3, 2026 at 7:05 PM Myrddin Emrys <my...@gm...> wrote: > I'm no expert in fish, even though it's my standard shell, but this feels > like something you could customize with an alias. > > function rmr > if test (count $argv) -eq 0 > echo "Usage: rmr <regex-pattern> [rm-flags]" > echo "Example: rmr '^[a-c].*' # removes files starting with a, b, > or c" > return 1 > end > rm $argv[2..-1] (string match -r $argv[1] *) > end > > Perhaps someone smarter than me could do it without requiring single > quotes around the regex. You could probably also make some equivalent `rmg` > variant by inserting some hellish Perl one-liner that converts glob syntax > into regex. > _______________________________________________ > Fish-users mailing list > Fis...@li... > https://lists.sourceforge.net/lists/listinfo/fish-users > |
|
From: Myrddin E. <my...@gm...> - 2026-10-03 16:04:16
|
I'm no expert in fish, even though it's my standard shell, but this feels
like something you could customize with an alias.
function rmr
if test (count $argv) -eq 0
echo "Usage: rmr <regex-pattern> [rm-flags]"
echo "Example: rmr '^[a-c].*' # removes files starting with a, b,
or c"
return 1
end
rm $argv[2..-1] (string match -r $argv[1] *)
end
Perhaps someone smarter than me could do it without requiring single quotes
around the regex. You could probably also make some equivalent `rmg`
variant by inserting some hellish Perl one-liner that converts glob syntax
into regex.
|
|
From: Ralph S. <ra...@ml...> - 2026-10-03 14:21:28
|
* paul: > fish does indeed not have the […]-globs. So it's not just a lack of search-fu. Bummer. > I didn't even know Bash had those, and tbh I'm not convinced they are > that useful, since they only match one char. They have frequently proven useful to me. For more complex tasks awk, find, sed, xargs et al exist, but as "rm [b-k]*" shows, Bash globbing can be enough. > The only fish-native commands that supports regex is `string`, so the > shortest fish-only equivalent would probably be > `rm (string match -r '^[b-k].*' *)` This has been suggested to me off-list as well. At least "string" is a fish builtin, but it still feels too elaborate. "find -regex ..." would work, but like I wrote, I'd rather avoid using additional commands if simpler options exist. Well, if that's a known fish weakness, I'll have to live with it. Fish has many strengths to make up for it. I mostly wanted to rule out having missed some obvious solution. -Ralph |
|
From: paul <pl....@gm...> - 2026-10-03 13:11:34
|
Hallo Ralph,
Am 03.10.26 um 13:02 schrieb Ralph Seichter via Fish-users:
> I wonder about the fish equivalent of calling `rm [b-k]*` in a Bash session.
fish does indeed not have the […]-globs.
I didn't even know Bash had those, and tbh I'm not convinced they are that useful, since they only match one char. For anything more complex than the * or ** globs I'd indeed use `find` or `fd` (a modern alternative to find with a much more intuitive syntax, see [2]).
The only fish-native commands that supports regex is `string`, so the shortest fish-only equivalent would probably be
`rm (string match -r '^[b-k].*' *)`
Note that this is full regex syntax, so it needs the ^ for start of the string. You can combine that with `path filter` if you want to filter out directories or symlinks.
Alternatively, Fish also supports {}-brace expansion, so you could write
`rm {b,c,d,e,f,g,h,i,j,k}*`
– more repetitive, but maybe even faster to type (and less to think about).
Most missing Bashisms can be worked around with the builtin commands [1]; especially `string`, `path` and `math` are incredibly useful, as is the builtin argparse.
paul
[1] https://fishshell.com/docs/current/commands.html#tools
[2] https://github.com/sharkdp/fd
--
√ https://wurzel.org
❤ https://neo-layout.org
❤ https://useplaintext.email
❤ YYYY-MM-DD (ISO 8601/RFC 3339)
� UTF-8
☠ please don't TOFU! https://en.wikipedia.org/wiki/Posting_style
|
|
From: Ralph S. <ra...@ml...> - 2026-10-03 11:21:16
|
Having read about wildcards (1) and fish for Bash users (2), I wonder about the fish equivalent of calling `rm [b-k]*` in a Bash session. Removing all files with names starting with the letters 'b' through 'k' using one short call is a breeze in Bash. How to do the same using fish builtins, without invoking additional commands like `find`, or writing scripts? (1) https://fishshell.com/docs/current/language.html#expand-wildcard (2) https://fishshell.com/docs/current/fish_for_bash_users.html -Ralph |
|
From: pnppl <pnp...@gm...> - 2026-05-29 07:21:08
|
If you have a personal website and want to share your love of fish on it, I've made a badge/button in the classic 88x31 pixel format that is experiencing a revival. Animated: <https://pnppl.cc/public/badges/fish.gif> Static: <https://pnppl.cc/public/badges/fish-static.gif> |
|
From: Bobby <pnp...@gm...> - 2026-03-11 15:50:40
|
Hi, just wanted to share a very simple but helpful function. It returns the parent folder of the given argument/pipe.
function folder
if ! isatty stdin
cat - | read -at argv
end
for file in $argv
echo (path resolve $file | path dirname | string split '/')[-1]
end
end
Note that you might want to remove the `resolve` part depending on your use case. For me it is more useful like this since I use it to rename files and I never need to name anything `.` .
I think `path` is one of the best things about Fish; it makes this kind of operation very easy. Even so, there was no convenient way that I could find to get only the containing folder, not the entire path. Now there is! :)
|
|
From: David A. <za...@uc...> - 2025-12-21 08:22:59
|
Hi all, The fish-shell repositories at download.opensuse.org have been producing warnings on newer versions of apt in Debian, because of a couple of problems with the Open Build Service signing mechanisms. These have now been fixed but everyone will need to re-download the key as it has been re-signed and the expiry extended. Please use something like: curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:4/Debian_13/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_4.gpg > /dev/null There is some discussion in the issue at GitHub: https://github.com/fish-shell/fish-shell/issues/11986 Thanks, David Adam fish committer za...@uc... |
|
From: Johannes A. <ac...@gm...> - 2025-09-27 20:45:34
|
See https://github.com/fish-shell/fish-shell/releases/tag/4.1.0 I can send a plaintext version of that changelog but I'd imagine that's less useful than a version with clickable links |
|
From: Johannes A. <ac...@gm...> - 2025-09-18 08:23:34
|
See https://github.com/fish-shell/fish-shell/releases/tag/4.0.8 |
|
From: Johannes A. <ac...@gm...> - 2025-09-12 10:44:44
|
See https://github.com/fish-shell/fish-shell/releases/tag/4.0.6 |
|
From: David A. <za...@uc...> - 2025-04-20 15:37:49
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi all, I'm pleased to announce the release of fish 4.0.2. This is a bugfix release for fish 4.0.0, which it appears I never actually announced on the list - the message was signed and ready to go, but still in my drafts. Here's the announcement from that message: > This release of fish features significant improvements in terminal > support which allow the use of many more key combinations, and a better > way of binding these combinations. There is also a new way to control > whether commands are added to the history, and a number of other new > features. > > There are a number of backward-incompatible changes, hence the increase > in the major version number. It is more important than ever to read the > release notes - see below! > > The internals of fish have been rewritten from C++ to Rust, which has > generated a lot of interest and publicity, but should only directly > impact developers and packagers. The tarball and packages for Linux, macOS and Windows will soon be available from https://fishshell.com/ and the release notes will be at https://fishshell.com/release_notes.html - but in the meantime I have uploaded the release to the GitHub releases page at: https://github.com/fish-shell/fish-shell/releases/tag/4.0.2 As a new major version, there is a new release:4 channel, so to receive the newest Linux packages you may need to update your configuration. If you'd like to use this method, the links are: https://launchpad.net/~fish-shell/+archive/ubuntu/release-4 (Ubuntu) https://software.opensuse.org//download.html?project=shells%3Afish%3Arelease%4A3&package=fish (Debian, Fedora, and openSUSE) A pull request for Homebrew has been merged, making the new version available via upgrading or running `brew install fish`. For our distributors, the tarball is available at https://github.com/fish-shell/fish-shell/releases/download/4.0.2/fish-4.0.2.tar.xz The SHA-256 sum is 6e1ecdb164285fc057b2f35acbdc20815c1623099e7bb47bbfc011120adf7e83 and the tarball has a signature from my personal PGP key, as does this message. It's my pleasure to welcome the huge number of new contributors who have commits in the tree since 3.7.0: Abdo Omar, Abel Chalier, Alexei Mikhailov, Ambrose Bonnaire-Sergeant, Andrew Neth, Anurag Singh, Armin Brauns, Bartłomiej Maryńczak, BrewingWeasel, César Sagaert, ClaXXX, Clemens Wasser, Daniel Fleischer, Demian Ferreiro, Dezhi Wu, EmilyGraceSeville7cf, Francois Laithier, Giorgio Gallo, Grant Hutchins, Harmen, Hauke Strasdat, Himadri Bhattacharjee, Jacob Chapman, Jadi, Jasmin Oster, Jean-Bernard Valentaten, Joan Bruguera Micó, Joe Adams, John, Jonathan Krebs, Josef Litoš, Kaley Main, Kemel Zaidan, Kendell R, Kerim, Klaus Hipp, Laurențiu Nicola, LingMan, Looouiiis, Lucas Garron, Lzu Tao, Manlio Perillo, Manuel Krebs, Max Jacobson, Michal Koutný, Munzir Taha, Nadir Fejzic, Neeraj Jaiswal, Nguyen Huu Kim, Nihaal Sangha, Nikita Bobko, Peter Yates, Pi-Cla, PolyMeilex, Rebecca Turner, Rikuki IX, RomainGiraud, Ryan Patterson, Sam Bull, Samuel Collins, Schlomo Schapiro, Septatrix, Shaik Azhar Madar, Shou Ya, Simon Junod, Steve Walker, TAKAHASHI Shuuji, Thayne McCombs, Theodor Tonum, Theodore Ehrenborg, Thomas Queiroz, Trishank Karthik Kuppusamy, Unbelievable Mystery, Verte, Victor Song, Yonas Yanfa, Zapeth, a-kenji, ahaoboy, amiyzku, bitraid, cornmander, diniamo, esdmr, fossdd, hdhoang, idealseal, iselda aiello, kerty, kpbaks, metamuffin, phanium, tesuji, triallax, visrosa, vp2177, yinm, and 王宇逸 Thanks also go to our returning contributors: Adam J. Stewart, Agatha Lovelace, Akatsuki Rui, Alex Chan, Amos Bird, Amy Grace, Andre Eckardt, Andy Hall, Asuka Minato, AsukaMinato, Axlefublr, Benjamin Kellermann, Branch Vincent, Charlotte, Chris Wendt, Christian Fersch, Colin Woodbury, Damien Picard, Daniel Bretoi, Daniel Kahn Gillmor, Delapouite, Dmitriy Shishkov, Dmitry Gerasimov, Eddie Lebow, Emily Grace Seville, Eric N. Vander Weele, Fabian Boehm, Felix Luciano Salomon, Florian Meißner, Gabriel Górski, Gregory Anders, Grzegorz Milka, Henrik Hørlück Berg, Husam Harazi, Ian Chamberlain, Ikko Eltociear Ashimine, Ilya Grigoriev, Ivan Kovnatsky, Jan Tojnar, Jannik Vieten, Jason Nader, Jay, Jo, Johannes Altmanninger, Johannes Stölp, Kevin F. Konrad, Kevin Cali, Kevin F. Konrad, Kid, Lia Lenckowski, Mahmoud Al-Qudsi, Marcelo Mendes Spessoto Junior, Marcin Wojnarowski, Mark Huang, Mathijs Henquet, Mathis Chenuet, Maurizio De Santis, Miha Filej, Nater0214, Nethum Lamahewage, NextAlone, Nicholas Rodrigues Lordello, Nunzio Cicone, Oliver Schrenk, Paiusco, Paul Gier, Paul Ouellette, Pavel savchenko, Paweł Piątkowski, Peter Collingbourne, QianChenglong, Quinten Roets, Robert Szulist, Rocka, Roland Fredenhagen, Rudolf Lovrenčić, SanskritFritz, Shun Sakai, Simon Börjesson, The0x539, Thomas Klausner, Wadii Hajji, Wenhao Ho, Wolfgang Müller, Wout De Puysseleir, Xiretza, Yuntao Zhao, Zehka, abp, bagohart, elyashiv, exploide, figurantpp, fortifiedhill, ghostflyby, jydeng, lengyijun, matt wartell, mattmc3, may, mhmdanas, nat-418, pd, rymrg, sigmaSd, tangowithfoxtrot, yanshay, ysthakur, zuisong, and the brains of the entire operation, ridiculousfish. It may be a little Rusty, but we hope you enjoy this release of fish. Thanks, David Adam fish committer za...@uc... -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEnh3gZzzMAykZ0YUmwLlpspdOiI4FAmgFEBkACgkQwLlpspdO iI7A5g//bLW2YBOz1LQfmgH1TcQh2heVPwadyw3Pkvxf1lToR9irRP7Oq9WZYCgz hH3zn2Iljatrsvn03OR+OVyoFo9ZE9Wixi5opw6wtpWBVHY9OstFuTV2RbHL79s+ Ch0fXNiTkgoSaSe2s+JY9OTeVQcy9GxYzB17JpqgmNgepzLBQqSvbnA5ejc0tNES lEvSfNw8Fyj8blCvos4irxF/mdYUXyYhWzaSBnb3F9uLDEFbuWxh4Ha8JYdN9Yaw jecIgtw44ecOPCzrGNbGguH/JjfGGcVXHK3Jac49mt4cmAu2AgGUM60p4pn+wgv/ ad+NqrSOgsYOFm6ZJdise/My2eDrUYGYimZG3tLnr33DrW4rXda2eJNgXXyxbOka Ys4ID3PvYiEXk1pXMYxJFIBJcuudpw7mkdmjvRdvEbO+SPM8QRj9ga32Ao2Z4pKM ME1AVVw8cLFiMtgFKoiEnl2+iLZvvp283isGjCkCma77PbFC+ozeUwaEZaMyZCoy OzSBzhNG5TAnsvgDT7a2zH+LI0WveN2a7UWA+C1YR/TAASTZCJTECBSwLnutrI/D ROs3aYx5t1B1JHHIlcX9S96cyahfGn6haJrXnjaaksjLxYgyrQNFS7fG7ye8PlM2 mT4Q+bIlYNrq5z6lJlZPDHqEUz0AviODAGYMTUF7YYjlpzNdg3I= =/aLn -----END PGP SIGNATURE----- |
|
From: Manfred L. <man...@po...> - 2025-01-12 11:49:58
|
Hi Xavier,
On 1/7/25 19:46, Xavier Maillard wrote:
> Hello
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
>
> I am a new fish user trying to figure out all the concepts and features.
>
> I browse many github repositories to get some inspiration.
>
> Many people seems to mixup abbreviations and functions. I mean, some functi=
> ons could have been abbreviations.
>
For me it is like this.
For the simple stuff I use aliases.
Here some examples
```
alias lsbig "ls -s size -l | tail -n 10"
...
if command -sq dnf
alias dnfs="dnf search"
alias dnfi="sudo dnf install"
alias dnfr="sudo dnf remove"
alias dnfl="sudo dnf list"
alias dnfu="sudo dnf upgrade"
alias dnfli="sudo dnf list installed"
alias dnfc="sudo dnf clean all"
alias dnfgi="sudo dnf groupinstall"
alias dnfgl="sudo dnf grouplist"
alias dnfgr="sudo dnf groupremove"
end
```
For more complex stuff I use functions
Examples
```
function mkcd
set -l newdir $argv[1]
mkdir -p $newdir
cd $newdir
end
```
```
# quick way to show number of files, dirs and symlinks
# in a directory tree
function filestat
set -l start_dir $argv[1]
if [ -z $start_dir ]
set start_dir '.'
end
set -l numf (find $start_dir -type f | wc -l)
set -l numd (find $start_dir -type d | wc -l)
set -l numl (find $start_dir -type l | wc -l)
echo "#dirs=$numd, #files=$numf, #links=$numl"
end
```
I use abbreviations only for stuff like this
```
abbr --add --position anywhere G '| grep'
```
Here I can type, for example: `ls -l G` and a blank and it gets expanded to
`ls -l | grep`
But your mileage may vary. 😁
--
Manfred
|
|
From: Xavier M. <x...@ma...> - 2025-01-10 18:30:22
|
Rens Oliemans <ha...@re...> wrote: > "Xavier Maillard" <x...@ma...> writes: > > > I just need to understand how things should be done. > > Try things out, and get a feel for your preference: the docs describe three ways > of doing it and I don't think that there are very clear ways of how it "should" > be done. Actually, that's my conclusion too. Just that, AFAICS, only functions can be exploited to do complex things. Right ? -- -Xavier |
|
From: Rens O. <ha...@re...> - 2025-01-08 08:44:12
|
"Xavier Maillard" <x...@ma...> writes: > I just need to understand how things should be done. Try things out, and get a feel for your preference: the docs describe three ways of doing it and I don't think that there are very clear ways of how it "should" be done. Using 'function' has two caveats that 'alias' fixes (and 'abbr' doesn't have), so preferring alias/abbr over function would be my advice, but that's also my preference: if you like the explicitness of function, go for it. |
|
From: Xavier M. <x...@ma...> - 2025-01-08 04:28:20
|
Rens Oliemans <ha...@re...> wrote: > "Xavier Maillard" <x...@ma...> writes: > > > I am a new fish user trying to figure out all the concepts and features. > > Welcome! I'm also a somewhat new fish user, but here's what I use--you can find > my dotfiles at > https://git.sr.ht/~rensoliemans/dotfiles/tree/main/item/fish/dot-config/fish > Thank you very much for sharing this with me. Things become clearer as I progress in my discovery and reading of the documentation. -- -Xavier |
|
From: Xavier M. <x...@ma...> - 2025-01-08 04:06:44
|
Hello, MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable makes sense. I plan migrating some scripts I am currently using in zsh as f= ish functions/scripts. Notably, I am using mblaze for my mails and I am pretty sure many things I = am doing today with complex scripts could be done as a fish flugin with fun= ctions, abrreviations and completions. I just need to understand how things should be done. --=20 -Xavier |
|
From: Greg R. <gre...@um...> - 2025-01-08 03:16:26
|
On Tue, Jan 7, 2025, at 9:42 PM, Xavier Maillard wrote: > I already have read that. My question was really this one: is it fine > to use ‘function’ as a mean to define what could have been a simple > abbreviation. > > For example: > > function wget --description 'alias wget=wget > --hsts-file="$XDG_DATA_HOME/wget-hsts"' > command wget --hsts-file="$XDG_DATA_HOME/wget-hsts" $argv > end > > Or > > abbr -a wget 'wget --hsts-file="$XDG_DATA_HOME/wget-hsts"’ > > Which one is okay/preferred ? I think that they are both okay. I think the preference is for you to decide. I think that the documentation that I mentioned at https://fishshell.com/docs/current/interactive.html#abbreviations explains the difference: "The advantage [of abbreviations] over aliases [and functions] is that you can see the actual command before using it, add to it or change it, and the actual command will be stored in history." If you want that feature, use an abbreviation. If you don't want that feature, use an alias/function. If you don't care then you don't care. |
|
From: Xavier M. <x...@ma...> - 2025-01-08 02:42:23
|
Hello, > Le 7 janv. 2025 à 21:06, Greg Reagle <gre...@um...> a écrit : > > You might be interested in abbreviations which has a man page called abbr, or see https://fishshell.com/docs/current/interactive.html#abbreviations > > The man page for alias notes that it is a wrapper for functions. See https://fishshell.com/docs/current/language.html#defining-aliases I already have read that. My question was really this one: is it fine to use ‘function’ as a mean to define what could have been a simple abbreviation. For example: function wget --description 'alias wget=wget --hsts-file="$XDG_DATA_HOME/wget-hsts"' command wget --hsts-file="$XDG_DATA_HOME/wget-hsts" $argv end Or abbr -a wget 'wget --hsts-file="$XDG_DATA_HOME/wget-hsts"’ Which one is okay/preferred ? Thank you |