128 Members
fish is a smart and user-friendly command line shell for Linux, macOS, and the rest of the family https://fishshell.com/8 Servers

Load older messages

Timestamp Message
4 Jun 2020
16:05:22@gitter_ryzokuken:matrix.orgUjjwal Sharma (Gitter)are universal vars most appropriate for it?
16:16:18@gitter_faho:matrix.orgFabian Homborg (Gitter) I'd probably use a file I'd source. Universal variables have weird interactions with exporting.
16:16:29@gitter_faho:matrix.orgFabian Homborg (Gitter) (use a file and make the variables global, I mean)
16:28:48@gitter_ryzokuken:matrix.orgUjjwal Sharma (Gitter) @faho that does make sense to me, you're right.
16:29:27@gitter_ryzokuken:matrix.orgUjjwal Sharma (Gitter) so basically a tiny script with set -x <var> <val> lines and source <file> in my config.fish?
16:30:29@gitter_faho:matrix.orgFabian Homborg (Gitter)Yeah
16:30:48@gitter_ryzokuken:matrix.orgUjjwal Sharma (Gitter) @faho thanks, will do.
16:54:57@gitter_faho:matrix.orgFabian Homborg (Gitter) I mean if the last command started with sudo, you don't need to prepend sudo?
16:56:13@gitter_faho:matrix.orgFabian Homborg (Gitter)Yeah, sure.
17:12:56@gitter_faho:matrix.orgFabian Homborg (Gitter) We actually can't.
17:13:24@gitter_faho:matrix.orgFabian Homborg (Gitter) The problem is that there's no real way of using it without also squashing spaces, which would be weird.
17:14:25@gitter_faho:matrix.orgFabian Homborg (Gitter) Yeah, I tried a couple permutations. Handling multiline commandlines is hard but possible, but squashing spaces (and possibly doing more to the commandline) feels weird, so I'm not using tokenization.
17:16:05@gitter_faho:matrix.orgFabian Homborg (Gitter) string match is simpler
17:29:16@gitter_zx8:matrix.orgzx8 (Gitter) @faho Regarding fish-shell/fish-shell@e646285 – if the last command I used started with sudo, I get sudo sudo now. Perhaps use echo $history[1] | read -at cmd instead?
17:29:51@gitter_zx8:matrix.orgzx8 (Gitter)Then the rest of the function works as normal.
18:09:57@gitter_zx8:matrix.orgzx8 (Gitter) Yeah, agree, but I did it while testing the new feature, not something that's likely to happy in reality.
18:10:10@gitter_zx8:matrix.orgzx8 (Gitter) Then I remembered we had the fancy new(ish) read -t we could use :)
18:11:02@gitter_zx8:matrix.orgzx8 (Gitter)Oh, how come?
18:11:18@gitter_zx8:matrix.orgzx8 (Gitter)Ahhh
18:11:56@gitter_zx8:matrix.orgzx8 (Gitter)Fair enough, leave it as-is then. No big deal.
18:15:18@gitter_zx8:matrix.orgzx8 (Gitter) I suppose you could check if string sub --length=5 -- $history[1] = "sudo " then do nothing, but it's probably not worth it
18:15:45@gitter_zx8:matrix.orgzx8 (Gitter):thumbsup:
5 Jun 2020
00:48:17@gitter_ilancosman:matrix.orgIlan Cosman (Gitter)

Hi, how would I give a list back to a command substitution?


function blah
    set -l output
    set -a output foo
    set -a output bar
    set -a output baz
    # echo $output[1] <-- prints 'foo' :)
    # echo $output[2] <-- prints 'bar' :)
    # echo $output[3] <-- prints 'baz' :)
    echo $output # <-- prints 'foo bar baz' :)

function blargh
    set -l blahOutput (blah)
    echo $blahOutput[2] # :( prints 'foo bar baz', I'd like it to print 'bar'
00:52:19@gitter_ilancosman:matrix.orgIlan Cosman (Gitter) (edited) ... prints 'foo bar baz', I'd ... => ... prints nothing, I'd ...
05:15:13@gitter_faho:matrix.orgFabian Homborg (Gitter) @IlanCosman Fish splits command substitutions on newline only, so you need to print one thing per line. Quickest way to do that is printf %s\n $output.
05:22:15@gitter_ilancosman:matrix.orgIlan Cosman (Gitter) Thanks as always @faho <3
6 Jun 2020
03:00:16@gitter_ilancosman:matrix.orgIlan Cosman (Gitter) What's the recommended way to run stuff at shell startup without messing with user's config.fish?
05:12:36@gitterbot:matrix.orgGitter Integration AkhIL ~/fish/conf.d/ ?
05:14:57@gitterbot:matrix.orgGitter Integration AkhIL > <@gitter_ilancosman:matrix.org> What's the recommended way to run stuff at shell startup without messing with user's config.fish? add your configuration to ~/fish/conf.d/some_name.fish
05:57:33@gitter_faho:matrix.orgFabian Homborg (Gitter) Almost. It's ~/.config/fish/conf.d, @IlanCosman

There are no newer messages yet.

Back to Room List