!YLTeaulxSDauOOxBoR:matrix.org

#fish-shell

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

Load older messages


SenderMessageTime
24 May 2022
@merlinox:matrix.orgmerlinoxwhat does this mean ? Oo12:47:20
@merlinox:matrix.orgmerlinox *

Hello there !
I'm using an alias to launch a lutris game

alias sc="lutris lutris:rungame/starcraft-ii&"

This produces this message (and still launches)

  • (line 1): The expanded command was empty.
    function sc --wraps 'lutris lutris:rungame/starcraft-ii&' --description 'alias sc=lutris lutris:rungame/starcraft-ii&'; lutris lutris:rungame/starcraft-ii& $argv; end
    ^
    in function 'sc'
12:50:23
@faho-55c2568b0fc9f982beac5856:gitter.imfaho (Fabian Homborg) @merlinox:matrix.org alias is a cheesy compatibility function that creates functions. 13:02:42
@faho-55c2568b0fc9f982beac5856:gitter.imfaho (Fabian Homborg)

In your case, that & means you want your command backgrounded, but alias doesn't know that, and it appends $argv to your command, so it looks like

lutris lutris:rungame/starcraft-ii& $argv

That & will terminate the command, so this is effectively

lutris lutris:rungame/starcraft-ii &
$argv

which tries to run the arguments you give to the function as a command - and since you gave no arguments, that's empty.

13:03:58
@faho-55c2568b0fc9f982beac5856:gitter.imfaho (Fabian Homborg)

Tbh what you want is to just make a function:

function sc
    lutris lutris:rungame/starcraft-ii &
end

or an abbreviation:

abbr sc 'lutris lutris:rungame/starcraft-ii &'

This will turn a typed sc into lutris lutris:rungame/starcraft-ii & inside the commandline before it executes.

13:05:12
@faho-55c2568b0fc9f982beac5856:gitter.imfaho (Fabian Homborg) (alias is supremely cheesy and overused and imho including it was a mistake, but it is what it is) 13:05:34
@merlinox:matrix.orgmerlinoxAaah, right. Thank you for the explanation :)13:11:11
@merlinox:matrix.orgmerlinoxI knew in the back of my head that aliases in my rc file weren't good with fish13:11:31
@merlinox:matrix.orgmerlinoxbut it worked13:11:33
@merlinox:matrix.orgmerlinoxand I have a lot of aliases so I stuck with them.13:11:41
@merlinox:matrix.orgmerlinoxI should be able to replace everything with abbr without problem, right ?13:11:52
@merlinox:matrix.orgmerlinoxRedacted or Malformed Event13:12:24
@merlinox:matrix.orgmerlinox *

do you think it will work with this syntax aswell ?

abbr sc="lutris lutris:rungame/etc"
?

13:12:27
@merlinox:matrix.orgmerlinox *

do you think it will work with this syntax aswell ?

abbr sc="lutris lutris:rungame/etc"

?

13:12:38
@faho-55c2568b0fc9f982beac5856:gitter.imfaho (Fabian Homborg) Basically, yeah 13:15:29
@merlinox:matrix.orgmerlinox%s/alias/abbr/g %s/="/"/g13:17:45
@merlinox:matrix.orgmerlinox😬13:17:50
@merlinox:matrix.orgmerlinoxwhoaaaa, it replaces the abbr immediately ! That's awesome. I should have done this wayyyy sooner 13:25:59
@merlinox:matrix.orgmerlinoxI can't wrap my head around why not everybody uses fish :(13:26:13
@merlinox:matrix.orgmerlinox set a profile picture.14:03:26
@merlinox:matrix.orgmerlinox changed their profile picture.14:03:35
@shalokshalom-5630051716b6c7089cb87f20:gitter.imShalokShalom (ShalokShalom) Hi there 14:45:52
@shalokshalom-5630051716b6c7089cb87f20:gitter.imShalokShalom (ShalokShalom) I can run fish scripts, who are not part of the auto-loaded fish-prompt, yeah? 14:46:28
@shalokshalom-5630051716b6c7089cb87f20:gitter.imShalokShalom (ShalokShalom) Since I just saved a file as name.fish and ran it with fish name.fish and it seems to not working. 14:46:52
@shalokshalom-5630051716b6c7089cb87f20:gitter.imShalokShalom (ShalokShalom) https://ibb.co/FsnBgns 14:49:29
@shalokshalom-5630051716b6c7089cb87f20:gitter.imShalokShalom (ShalokShalom) see the command line on the bottom 14:49:51
@stefan:zwanenburg.infopsYchotic

ShalokShalom (ShalokShalom): Add a cosmos line at the bottom of your cosmos-update.fish file, and it should work. That, or remove the function declaration altogether:

function cosmos
  kdialog --title "Garuda update" --yesno "There are new updates available. Do you like to install them now?"
  sudo pacman -Syu --downloadonly
end

cosmos

or

kdialog --title "Garuda update" --yesno "There are new updates available. Do you like to install them now?"
sudo pacman -Syu --downloadonly
14:54:02
@stefan:zwanenburg.infopsYchoticI suspect by "auto-loaded fish-prompt" you meant "autoloading functions" (https://fishshell.com/docs/current/language.html#autoloading-functions), is that right?14:55:47
@happyeggchen-62545d996da037398494407a:gitter.imhappyeggchen (tsingkwai) Um could anyone tell me how do i capture ctrl+c in fish shell? 15:11:19
@happyeggchen-62545d996da037398494407a:gitter.imhappyeggchen (tsingkwai) I tried trap and that didn't work 15:11:29

There are no newer messages yet.


Back to Room List