You are not logged in.

#1 2018-02-14 09:26:22

jozik
Member
Registered: 2017-04-21
Posts: 11

setting fish shell as default via .bashrc on server

Hi everyone,

I am trying to follow this wiki. My purpose is to set fish as default shell via .bashrc. Recently I added comment to this section that it will not work for scp but was deleted and I do not understand why. The comment in wiki history says:

Rdeckard wrote:

Remove warning about scp failing. That is due to people source bashrc (which is for interactive shells) from bash_profile (for login shells).

I tried not to source bashrc in .bash_profile, but scp still fails. Can anyone explain how can I setup fish from .bashrc without breaking scp?

Many thanks,
Jozef

Last edited by jozik (2018-02-14 09:35:45)

Offline

#2 2018-02-14 09:36:44

jozik
Member
Registered: 2017-04-21
Posts: 11

Re: setting fish shell as default via .bashrc on server

If I run "exec fish" from .bash_profile everything works fine, but wiki says it should be run from .bashrc

Offline

#3 2018-02-14 13:45:46

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: setting fish shell as default via .bashrc on server

This discussion belongs into the wiki, not the forum. You might want to address the author of the changes.
However: "I tried not to source bashrc in .bash_profile" isn't very convincing and you certainly should not.

If executing fish only works from bash_profile but not from bashrc, you're not starting an interactive (bash) shell.
I will however say that I find that entire article weird ("absurd") itfp. - you certainly do not want /bin/sh to resolve fish, but what's configured as your user shell should frankly not matter.

If you have any worries, you could also just alter the way you invoke your VTE (xterm, rxvt, konsole, ...) to execute fish (but oc you'll loose a wrapping bash context - whatever that seems to be good for)

Offline

#4 2018-02-14 13:49:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: setting fish shell as default via .bashrc on server

seth wrote:

you certainly do not want /bin/sh to resolve fish, but what's configured as your user shell should frankly not matter.

Agreed.  That section of the wiki really doesn't make sense at all.  The default shell for your user couldn't possibly break any scripts, that's just nonsense.

seth wrote:

you could also just alter the way you invoke your VTE (xterm, rxvt, konsole, ...) to execute fish

The OP did say this was for a system they ssh into, so the VTE isn't relevant here.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2018-02-14 14:45:08

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: setting fish shell as default via .bashrc on server

Trilby wrote:
seth wrote:

you certainly do not want /bin/sh to resolve fish, but what's configured as your user shell should frankly not matter.

Agreed.  That section of the wiki really doesn't make sense at all.  The default shell for your user couldn't possibly break any scripts, that's just nonsense.


They *might* have been confusing "shell scripts" with "shell configurations like /etc/profile.d/" but the article is confusing enough I couldn't possibly guess one way or another.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2018-02-14 15:08:12

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: setting fish shell as default via .bashrc on server

That would actually make quite sense....
Since fish doesn't support much of the bash syntax, notably not exporting environment vars with "FOO=bar" it'll fail to source /etc/profile.d/bag_of_bashism.sh, but can inherit the environment from a parenting process.

@jozik
You need to elaborate on the problem. What you're trying to do and what kind of error you receive. Also your bashrc and bash_profile would be of value.

---
@Trilby, I see "scp", but not "ssh" tongue

Offline

#7 2018-02-14 15:12:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: setting fish shell as default via .bashrc on server

seth wrote:

@Trilby, I see "scp", but not "ssh" tongue

The title seems to make it pretty clear: this is for the login shell on a server, not the local machine.

As for /etc/profile.d/* that could be a problem.  But I never source those anyways.  Any content of /etc/profile.d/ that would be of value should be trivial to translate to fish which would seem to be a far cleaner approach then running a turducken shell just to set a few environment variables (that may not even be needed for anything).

Last edited by Trilby (2018-02-14 15:42:13)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2018-02-14 15:40:58

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: setting fish shell as default via .bashrc on server

seth wrote:

That would actually make quite sense....
Since fish doesn't support much of the bash syntax, notably not exporting environment vars with "FOO=bar" it'll fail to source /etc/profile.d/bag_of_bashism.sh, but can inherit the environment from a parenting process.

But bash has nothing to do with anything. /etc/profile.d/*.sh is meant to be strictly POSIX sh. Which, then again, fish does not support either...

Then too, there is absolutely nothing stopping people from porting that to /etc/profile.d/*.fish except for the fact that fish is such a sucky shell no one has bothered. big_smile

We do in fact include several *.csh equivalents, which a csh shell can use by sourcing /etc/profile.d/*.csh and there is nothing stopping weirdo fish users from doing the same.

Last edited by eschwartz (2018-02-14 15:43:47)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#9 2018-02-14 15:50:03

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: setting fish shell as default via .bashrc on server

Just playing the /etc/profile.d theory on

wiki wrote:

In Arch, some shell scripts are written for Bash and are not fully compatible with fish.

But yes, indeed. FOO=bar is no bashism (but originates in ksh and is now POSIX since a while) - and still not supported by fish.

Offline

Board footer

Powered by FluxBB