On Sat, Aug 01, 2015 at 01:38:02PM -0600, @lbutlr wrote: > I was hoping the list was more active
FYI, the GitHub site at https://github.com/fish-shell/fish-shell/issues is very active with bug reports and feature requests. > Anyway, is there any sort of writeup anyone’s done on something like “fish > for bash users” or similar? The comparison at http://hyperpolyglot.org/unix-shells is good. Also, have you read the FAQ at http://fishshell.com/docs/current/faq.html and the tutorial at http://fishshell.com/docs/current/tutorial.html? > fish seems to have some different ideas about how to do things (preferring > functions in individual files over aliases or functions in a single rcfile > for one) That's the default way, but you don't have to do it that way. You can have all of your functions in one file if you like. You could put them all in config.fish. Fish supports the source command, so you can group them into files however you like. > Also, I’m not sure what the advantage is to creating a whole lot of files > each containing one to three lines in the functions folder. My guess is: The functions can be auto-loaded on first use that way, a performance gain over loading them all at start-up no matter whether they get used. > function gbz () { > for i in `ls | grep ".bz2"` ; do bzgrep -H "$*" $i; done > } > > If I am understanding the documentation, this would be rewritten into > …/functions/gbz.fish as > > function gbz > for i in *.bz2 > bzgrep -H $argv $i > end > end That looks right to me, but I haven't checked it. FYI, you can have the for loop in fish in one line if you'd like--use semicolons. E.g. for i in (seq 5) ; echo $i; end > Yes? How to I pass all the args properly escaped or quoted? Just “$argv” like > in the original? In fish, you just use $argv unquoted. This is exemplified in the tutorial. > What if I wanted to check that there was only one argv? Or similarly what if > I wanted to parse argv[1] and argv[2] separately? Use count. Again, see the tutorial. Example for i in (seq (count $PATH)); echo $i : $PATH[$i]; end > How about this one? > > function duh () { > du -s * | sort -n | cut -f 2- | while read a; do du -sh "$a"; done > } This: du -s * | sort -n | cut -f 2- | while read a; du -sh "$a"; end > I have about 100 aliases in .bashrc and quite a few functions. If you make an alias/function into a shell script it can be written in any shell language and it can be called from any shell, FYI. Translating and testing over 100 aliases and functions does not sound like fun to me. Since fish does things differently, some of them might not be necessary. You could try using fish without them and only translate the ones that you need. Also, the latest version of fish has abbreviations ("abbr" command) which are auto-expanding alias, see https://github.com/fish-shell/fish-shell/issues/731. ------------------------------------------------------------------------------ _______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users