Actually assigning to a temporary variable to avoid the unmatched glob error is quite a bit nicer:
set d /Applications/ghc-*.app/Contents/bin append_to_path_if_exists $d Michael On Tue, Jul 12, 2016 at 9:39 PM, Michael Stillwell <m...@beebo.org> wrote: > Is there any way to force fish to perform parameter expansion on a > variable? That is, if a variable is equal to "*.txt", how can that be > expanded to "bar.txt baz.txt" or "" or whatever it actually matches? > > The motivation for this is so that it's possible to write a function > "append_to_path_if_exists" that appends its argument to > fish_user_paths if and only if the argument actually exists as a > directory. So I want to be able to do: > > append_to_path_if_exists "/Applications/ghc-*.app/Contents/bin" > append_to_path_if_exists "~/.gem/ruby/*/bin" > append_to_path_if_exists "/usr/lib/go-*/bin" > > Without the quotes, fish (now) whines if these directories don't > exist, but with the quotes, I can't figure out a good way to actually > expand the argument within the append_to_path_if_exists function. > > This is sort of possible via a subshell, but it's hardly ideal: > > function glob > echo (fish -c "count $argv > /dev/null ; and echo $argv") > end > > $ glob "*.txt" > bar.txt baz.txt > $ glob "jjj*" > > (Also doesn't work with multiple arguments.) > > Am I going about this the wrong way? > > > > > Michael ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev _______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users