Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 11:16
    faho commented #9393
  • 11:16
    faho closed #9393
  • 11:15
    faho labeled #9393
  • 11:14
    zanchey commented #9393
  • 11:12
    faho commented #9393
  • 10:20
    floam commented #9394
  • 10:14
    floam edited #9394
  • 10:14
    floam labeled #9394
  • 10:14
    floam opened #9394
  • 10:08
    floam commented #9385
  • 10:07
    floam commented #9385
  • 09:43
    faho commented #9393
  • 09:42
    faho labeled #9393
  • 09:40
    faho commented #9393
  • 09:30
    h4l opened #9393
  • 05:29
    abosnjakovic starred fish-shell/fish-shell
  • 04:51
    floam commented on fd252da
  • 04:50

    floam on master

    ksh.fish fixup: remove errant l… (compare)

  • 04:47

    floam on master

    ksh completions: add descriptio… (compare)

  • 04:21
    floam synchronize #9345
Fabian Boehm
@faho
@andrewsh:matrix.org It's an mc bug - it tries to extract the first line of the prompt and is overly simplistic in doing so. https://midnight-commander.org/ticket/4258
andrewsh
@andrewsh:matrix.org
[m]
wow, 5 months and no fix?
Fabian Boehm
@faho
You'll have to talk to the mc people about that.
Fabian Boehm
@faho
Sometimes bugs happen, and sometimes nobody gets around to fixing them for a while, especially in a volunteer-driven project.
The only sure way to get a bug fixed now is to do it yourself.
andrewsh
@andrewsh:matrix.org
[m]
yeah, I guess
I have for now downgraded fish back to the version where it works
andrewsh
@andrewsh:matrix.org
[m]
anyway, added the details to the Debian bug report, hopefully the maintainer can have a look and figure something out
@faho: thanks!
Patrick
@PatrickF1
Why do these both output the same thing? According to my understanding of character escapes in single quotes, the \$ should result in no regex backreferencing happening
$ string replace -r '(\w+)\s+(\w+)' '$2 $1 $$' 'left right'
right left $
$ string replace -r '(\w+)\s+(\w+)' '\$2 \$1 $$' 'left right'
right left $
Fabian Boehm
@faho
@PatrickF1 #5474 - unfortunately string replace has a superfluous round of unescaping in the replacement part so you'll have to double up the slashes one more time. There's no great way of fixing it so we've introduced a feature flag until we figure out how to detect it and warn about it.
Patrick
@PatrickF1
Hi @faho , thanks for your reply. Why does string replace do a superfluous round of unescaping for the replacement part?
btw https://fishshell.com/docs/current/language.html#future-feature-flags says "round of escaping", but that should read "round of unescaping right"?
Fabian Boehm
@faho
Please read the linked issue. It was simply a mistake in the original implementation.
"un"escaping is a pretty technical term, it's when you turn $ into "expand this" and \$ into $. If it does too much unescaping that means you need more escaping. I do not believe this subtlety helps any in the explanation, so we've left it as "escaping".
Peter Ammon
@ridiculousfish
fish shell is on the orange site once again, lots of nice comments about it
David Adam
@zanchey
some nice comments on HN re: fish today
Jim Richardson
@weaselkeeper
tried fish today as result of reading about it in
HN
had avoided it for a while due to non-posix
hard to step out of decades of relying on posix shells...
Johannes Altmanninger
@krobelus
@weaselkeeper it's POSIX enough for lots of interactive scenarios
Jim Richardson
@weaselkeeper
yeah, focusing on it as an interactive shell, probably stick with bash/sh for scripting, but I do more and more of that in python these days than shell anyway.
If it's going to take more than a few lines/functions, it's getting done in python or a DSL instead of bash
Juan Patten
@jrpat
brand new fish user here. I want to check if a tmux session is running, without outputting anything to the shell. in bash, I do [ -n "$(tmux ls | grep foo)" ] && ... - In fish, the way seems to be set x (tmux ls | grep foo) ; if test $status -eq 0 ...
is there a better way?
Fabian Boehm
@faho

@jrpat If you're just interested in the exit status, simply put the command into the if-condition:

if tmux ls | grep foo

to ignore the output you'd usually redirect it to /dev/null (with the old >/dev/null), but in this case grep has a -q switch:

if tmux ls | grep -q foo

If you also want the output, you can still use the set:

if set x (tmux ls | grep foo)

set doesn't set the status itself and simply passes on whatever the command substitution returned.

Juan Patten
@jrpat
ah ok - very helpful. yeah it's nice that grep has a -q, but I also wondered about the general case when a command doesn't have a quiet flag. >/dev/null it is. thanks!
Subsentient
@Subsentient
Is there a good way to get the index of a particular occurence of a pattern in a string? Like Python's 'derp'.find('e')
Peter Ammon
@ridiculousfish
@Subsentient try e.g. string match --index --regex foo bigfoot, it will show the range of the regex match.
schuelermine
@schuelermine:matrix.org
[m]
Is it fish-specific or a general cross-shell convention that redirections are processed right-to-left?
i.e. cmd 2>&1 >file doesn’t redirect stderr to file, but cmd >file 2>&1 does
David Adam
@zanchey
hmm, the notifiers test seems a bit flaky
Peter Ammon
@ridiculousfish
@schuelermine:matrix.org redirections are processed left to right. 2>&1 means "stdout is dup'd to stderr" and >file means "file is dup'd to stdout". So in 2>&1 >file you end up with stderr as the original stdout, and stdout as the file.
2 replies
Aaron Gyes
@floam
I agree, and do miss --authoritiative; but I wish it were a bit easier to specify flags that can be used only n times and/or only with certain other options.
Peter Ammon
@ridiculousfish
All shells process redirections left to right AFAIK. The only divergent case is mixing a stdout redirection with a pipe.
Aaron Gyes
@floam
the conditionals I used in my few minutes ago completion commit kinda stink.
Peter Ammon
@ridiculousfish
Generating completions is an inherently messy process. I sometimes complete and intend to go back and fix up the command line later. Plus we have so much pain dealing with divergent implementations of utilities already, now imagine trying to encode all the divergent DSLs on top of that...yuck.
schuelermine
@schuelermine:matrix.org
[m]
Oh, I guess I mis-wrote
schuelermine
@schuelermine:matrix.org
[m]
OK
it just seems rather unintuitive is all
Aaron Gyes
@floam
some commands can be fully specified - like our builtins for example.
Peter Ammon
@ridiculousfish
Yeah, it feels backwards, huh. The syntax >file looks like "redirect the stdout stream to a file", but under the hood it's "throw away whatever stream is associated with stdout, and replace it with this file."
Streams don't have descriptors; a descriptor has a stream.
Aaron Gyes
@floam
hm
all streams have a descriptor, fileno() will tell it.
Peter Ammon
@ridiculousfish
By "stream" I don't mean FILE * which is just a libc thing, I mean the underlying kernel resource.
Aaron Gyes
@floam
maybe we could do something to make pipes and redirections more obvious, like highlighting the extent when the cursor is on the operator.
David Adam
@zanchey
ridiculousfish, that's a really interesting conceptualisation, had never occurred to me (but the backwardsness certainly had)