Bugzilla – Bug 1149882
/etc/profile fails to load if the user is using Fish as their shell
Last modified: 2019-09-12 07:21:31 UTC
For any user that has fish set as their default shell, /etc/profile is sourced using fish shell and /etc/profile is not compatible with fish. To create a reproducible error: - Open fish shell (it does not to be your default shell for this test) - Run the command "source /etc/profile" You will get this error: ``` /etc/profile (line 15): 'case' builtin not inside of switch block case "$0" in ^ from sourcing file /etc/profile called on standard input source: Error while reading file “/etc/profile” ``` Here is my full /etc/profile: https://hastebin.com/buyeruwoza.bash Thanks!
I am afraid that this is not a bug, you know fish has a different syntax from bash, and by default /etc/profile is written in bash syntax. It seems people suggests to use fish as interactive shell started by bash instead of as default shell, so you can load files with bash. Or you should rewrite /etc/profile in fish syntax by yourself because most people use bash as default shell and many shells use bash syntax.
@Alynx is partly correct, fish uses its own syntax which isn't posix compatible this means it can't source `/etc/profile` by design. Instead it ships its own config files in different locations, the equivalent to `/etc/profile` for configuration that affects all users on the system is `/etc/fish/config.fish` any changes you would normally make to `/etc/profile` should also be done there using fish syntax so that fish users pick them up. Fish however does work fine on openSUSE as a users default shell, I have been using it as mine for a number of years, I have an extensive config at https://github.com/simotek/tackle However it should be noted that currently openSUSE doesn't ship anything in `/usr/share/fish/vendor_cpnf.d` to replace the content of the standard `/etc/profile` so if you find anything that doesn't work in fish because its missing raise a bug and i'll include it. I suspect gcc is broken because of this so I plan to fix that and go through and look for other possible issues when I have time, but if you know of issues let me know and i'll make sure they are fixed as well.