When I Open Console both the .bashrc file and config.fish file are being read

This is more of a question than an issue, and I’m only posting it here because I wasn’t sure if it fit the feedback category.

I added an alias to my bash.rc file

alias python="python3.12"

After confirming this worked by checking my python version on the command line I decided to comment out the alias in the .bashrc file and instead add the alias to my config.fish file, which I also confirmed as successful.

My question is why is the .bashrc file being read when the fish shell has it’s config.fish file which makes the .bashrc file seem redundant unless I want to change the shell I’m using.

Edit:

System:
Kernel: 6.6.8-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
clocksource: tsc available: hpet,acpi_pm
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=1fcb8cbf-95d5-4677-900a-f2395c94658e rw rootflags=subvol=@
quiet loglevel=3 ibt=off
Desktop: KDE Plasma v: 5.27.10 tk: Qt v: 5.15.11 wm: kwin_wayland vt: 1
dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:
Type: Laptop System: HP product: HP Laptop 15-dw0xxx v: Type1ProductConfigId
serial: <superuser required> Chassis: type: 10 serial: <superuser required>
Mobo: HP model: 85F5 v: 39.46 serial: <superuser required> UEFI: Insyde
v: F.63 date: 08/24/2023
Battery:
ID-1: BAT1 charge: 41.2 Wh (100.0%) condition: 41.2/41.0 Wh (100.4%)
volts: 12.8 min: 11.4 model: COMPAL PABAS0241231 type: Li-ion
serial: <filter> status: full
CPU:
Info: model: Intel Pentium Silver N5030 bits: 64 type: MCP
arch: Goldmont Plus level: v2 built: 2017 process: Intel 14nm family: 6
model-id: 0x7A (122) stepping: 8 microcode: 0x22
Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 224 KiB
desc: d-4x24 KiB; i-4x32 KiB L2: 4 MiB desc: 1x4 MiB
Speed (MHz): avg: 2333 high: 2439 min/max: 800/3100 scaling:
driver: intel_cpufreq governor: schedutil cores: 1: 2439 2: 2370 3: 2263
4: 2263 bogomips: 8755
Flags: ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
Vulnerabilities: <filter>
Graphics:
Device-1: Intel GeminiLake [UHD Graphics 605] vendor: Hewlett-Packard
driver: i915 v: kernel arch: Gen-9.5 process: Intel 14nm built: 2016-20
ports: active: eDP-1 empty: HDMI-A-1 bus-ID: 00:02.0 chip-ID: 8086:3184
class-ID: 0300
Device-2: Quanta HP TrueVision HD Camera driver: uvcvideo type: USB
rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-5:3 chip-ID: 0408:5365
class-ID: 0e02
Display: wayland server: X.org v: 1.21.1.10 with: Xwayland v: 23.2.3
compositor: kwin_wayland driver: X: loaded: modesetting
alternate: fbdev,intel,vesa dri: iris gpu: i915 display-ID: 0
Monitor-1: eDP-1 res: 1366x768 size: N/A modes: N/A
API: EGL v: 1.5 hw: drv: intel iris platforms: device: 0 drv: iris
device: 1 drv: swrast surfaceless: drv: iris wayland: drv: iris x11:
drv: iris inactive: gbm
API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 23.3.2-arch1.2
glx-v: 1.4 direct-render: yes renderer: Mesa Intel UHD Graphics 605 (GLK 3)
device-ID: 8086:3184 memory: 3.55 GiB unified: yes display-ID: :1.0
API: Vulkan v: 1.3.274 layers: 3 device: 0 type: integrated-gpu name: Intel
UHD Graphics 605 (GLK 3) driver: mesa intel v: 23.3.2-arch1.2
device-ID: 8086:3184 surfaces: xcb,xlib,wayland device: 1 type: cpu
name: llvmpipe (LLVM 16.0.6 128 bits) driver: mesa llvmpipe
v: 23.3.2-arch1.2 (LLVM 16.0.6) device-ID: 10005:0000
surfaces: xcb,xlib,wayland
Audio:
Device-1: Intel Celeron/Pentium Silver Processor High Definition Audio
vendor: Hewlett-Packard driver: snd_hda_intel v: kernel
alternate: snd_soc_skl, snd_soc_avs, snd_sof_pci_intel_apl bus-ID: 00:0e.0
chip-ID: 8086:3198 class-ID: 0403
API: ALSA v: k6.6.8-zen1-1-zen status: kernel-api tools: N/A
Server-1: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: Hewlett-Packard driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
lanes: 1 port: 2000 bus-ID: 01:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: eno1 state: down mac: <filter>
Device-2: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter
vendor: Hewlett-Packard driver: rtw_8821ce v: N/A modules: rtw88_8821ce
pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: 1000 bus-ID: 02:00.0
chip-ID: 10ec:c821 class-ID: 0280
IF: wlo1 state: up mac: <filter>
Bluetooth:
Device-1: Realtek Bluetooth 4.2 Adapter driver: btusb v: 0.8 type: USB
rev: 1.1 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-4:2 chip-ID: 0bda:b00a
class-ID: e001 serial: <filter>
Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 4.2
lmp-v: 8 status: discoverable: no pairing: no class-ID: 7c010c
Drives:
Local Storage: total: 465.76 GiB used: 46.93 GiB (10.1%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/sda maj-min: 8:0 vendor: Toshiba model: MQ01ABF050
size: 465.76 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
tech: HDD rpm: 5400 serial: <filter> fw-rev: 3C scheme: GPT
Partition:
ID-1: / raw-size: 465.46 GiB size: 465.46 GiB (100.00%)
used: 46.93 GiB (10.1%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 584 KiB (0.2%) fs: vfat dev: /dev/sda1 maj-min: 8:1
ID-3: /home raw-size: 465.46 GiB size: 465.46 GiB (100.00%)
used: 46.93 GiB (10.1%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
ID-4: /var/log raw-size: 465.46 GiB size: 465.46 GiB (100.00%)
used: 46.93 GiB (10.1%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
ID-5: /var/tmp raw-size: 465.46 GiB size: 465.46 GiB (100.00%)
used: 46.93 GiB (10.1%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
ID-1: swap-1 type: zram size: 3.64 GiB used: 930.2 MiB (25.0%)
priority: 100 comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 4
dev: /dev/zram0
Sensors:
System Temperatures: cpu: 73.0 C mobo: N/A
Fan Speeds (rpm): N/A
Info:
Processes: 203 Uptime: 4d 11h 29m wakeups: 0 Memory: total: 4 GiB
available: 3.64 GiB used: 1.67 GiB (45.9%) Init: systemd v: 255
default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
Packages: pm: pacman pkgs: 1393 libs: 400 tools: octopi,paru Shell: fish
v: 3.6.4 running-in: konsole inxi: 3.3.31
Garuda (2.6.22-1):
System install date:     2023-11-27
Last full system update: 2024-01-02 ↻
Is partially upgraded:   No
Relevant software:       snapper NetworkManager dracut
Windows dual boot:       No/Undetected
Failed units:            archlinux-keyring-wkd-sync.service

I would request you to follow template even if you are asking questions.

I believe that this alias is redundant pretty sure that pacman creates a symlink in /usr/bin for python that points to whatever the latest version of python is installed.

It’s not. bashrc cannot be read by fish. Fish uses functions to work and provides the options of creating config.fish and having alias keywords just for making people coming from bash land feel more comfortable. Internally all aliases are transformed to functions.

Fish is incapable of working on bash scripts. They have different syntax. For example a simple alias egrep in your config.fish is translated by fish to this,

 functions egrep
# Defined via `source`
function egrep --wraps='ugrep -E --color=auto' --description 'alias egrep ugrep -E --color=auto'
  ugrep -E --color=auto $argv
        
end
3 Likes

No, it didn’t create a symlink.

I verified this before I added the alias.

I added the alias because using either python or python3 were both pointing to the older version of python installed with Garuda.

To use python 3.12 before adding the alias in the .bashrc I would have to type python3.12 in Konsole, using the fish shell, to run python 3.12 specifically.

I don’t know why it worked with fish when editing the .bashrc file, but it did.

Edit,

Yes, I’ll use the template in the future, thank you.

Also, I did not use pacman to install as the latest version of python is not in the repository. The repository version is 3.11, last time I checked, so I installed 3.12 from source.

I see. In that case this is indeed strange how your bash aliases were reflected in fish as well. :thinking: fish just doesn’t work that way. There must be something else going on in your system that we are missing out on.

There is an aur package,
https://aur.archlinux.org/packages/python312

It will install python 12 alongside the current python package you have from what I know.

2 Likes

Yeah, I looked at that yesterday, but I wasn’t sure if it was going to replace or install alongside the system python so I decided on a source install since I knew that wouldn’t replace it.

Thank you.

What would you recommend as a good place to start looking as to why the system is behaving this way?

Can you share what exact steps you took to manually install python 12? maybe that provides a hint. Also please update your original post with garuda-inxi.

1 Like

Sure

After downloading, extracting, and getting into the directory in Konsole

using sudo:
./configure
make
make test
make install

NaN is right, this does not occur. One or the other will be in use depending on the shell you are using.

Here is a simple test, for example:

~ 
❯ echo "alias foo='echo bar'" >> ~/.bashrc

~ 
❯ bash

~ 
❯ foo
bar

~ 
❯ fish

~ 
❯ foo
fish: Unknown command: foo

If you are inside the directory where Python was set up, then that will be set as the local Python version. If you are outside of that directory, then most likely you have set that version as the global Python version.

Perhaps this will be a good place to start: https://wiki.archlinux.org/title/Python/Virtual_environment#Python_versions

Python versions

By default, virtual environments are created using system Python. The bin/python binary is just a symlink to system python:

$ ls -l *envname*/bin/python 
lrwxrwxrwx 1 foo foo 15 Jan 29 18:48 *envname*/bin/python -> /usr/bin/python

If you want to use a different Python version inside the virtual environment, you can use the -p/--python option of virtualenv:

$ virtualenv -p 3.8 *envname* 
$ ls -l *envname*/bin/python 
lrwxrwxrwx 1 foo foo 18 Jan 29 18:48 *envname*/bin/python -> /usr/bin/python3.8

pypy3 can also be used:

$ virtualenv -p pypy3 *envname*
1 Like

hmm are you sure you ran that because I too downloaded the latest python package from it’s site and ran the configure script which generated the Makefile and it contained this,

# Generated automatically from Makefile.pre by makesetup.
# Top-level Makefile for Python
#
# As distributed, this file is called Makefile.pre.in; it is processed
# into the real Makefile by running the script ./configure, which
# replaces things like @spam@ with values appropriate for your system.
# This means that if you edit Makefile, your changes get lost the next
# time you run the configure script.  Ideally, you can do:
#
#   ./configure
#   make
#   make test
#   make install
#
# If you have a previous version of Python installed that you don't
# want to overwrite, you can use "make altinstall" instead of "make
# install".  Refer to the "Installing" section in the README file for
# additional details.
#
# See also the section "Build instructions" in the README file.

# === Variables set by makesetup ===

at top.

from readme,

sudo make install

This will install Python as ``python3``.

and from my system,

ls /usr/bin/python
lrwxrwxrwx - root 14 Nov  2023  /usr/bin/python -> python3

yes, that is what I ran.

Question: 100% sure a bash alias did actually work in fish?

I found a few ways by which that is possible, but one would know if that’s the case.
Except perhaps, simple bash aliases (that do not use any bash syntax) can be sourced in a fish config. Maybe that by mistake?

One terribly old question on StackExchange (there are more) about other tricks:
shell - re-use '~/.profile` for Fish? - Super User
(the mentioned import_bash_settings.py I guess it’s no more)

I have not tried any of them if they actually work.
I could not get aliases nor functions to “spill over” by simple export and export -f.

Well I guess the mystery is solved.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.