Am i supposed to be converting bash scripts to fish syntax?

Hello, Everyone. New Garuda user. Ok, new linux user :slight_smile:

I'm following a tutorial video about using anaconda for python. They went to the anaconda web site to download it, but I imagined using octopi was 'better' ? Does it matter?

Anyway, I got it installed well enough via konsole & fish shell but when i went to execute the conda command, it wasn't found. The video said if you have an error, run source ~/.bashrc

When I did, it complained about an equal sign not being valid in fish, suggesting that I use 'set' instead. So, i commented out the offending line and copied it with 'set' as a prefix.

ran source again, and it said no closure to an 'if' in the bashrc. I looked up and found that fish wants 'end' rather than 'fi', and started to change those, too.

But i'm now wondering whether this is what I'm supposed to be doing. I mean, if ever I decide to change my shell to bash or zsh, won't I have to undo what I'm doing now? That doesn't seem like I'm going about this the right way, so here I am to ask:

What's the right/better way for me to handle this situation? Should I just change my shell to bash? Or, is there a way to keep fish but still run bash scripts without having to edit them for differences?

Thanksin advance for your insights!

Oh, in order to be compliant with the forum rules, here's my garuda-inxi output:

System:
Kernel: 5.18.5-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 12.1.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=fe2a04e0-7e03-49df-b233-906e6e1b68c0 rw [email protected]
quiet quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
loglevel=3
Desktop: KDE Plasma v: 5.25.1 tk: Qt v: 5.15.5 info: latte-dock
wm: kwin_x11 vt: 1 dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:
Type: Laptop System: Micro-Star product: Bravo 15 B5DD v: REV:1.0
serial: <superuser required> Chassis: type: 10 serial: <superuser required>
Mobo: Micro-Star model: MS-158K v: REV:1.0 serial: <superuser required>
UEFI: American Megatrends LLC. v: E158KAMS.108 date: 08/04/2021
Battery:
ID-1: BAT1 charge: 50.7 Wh (96.6%) condition: 52.5/52.0 Wh (101.0%)
volts: 12.8 min: 11.4 model: MSI Corp. MS-158K type: Li-ion serial: N/A
status: N/A
CPU:
Info: model: AMD Ryzen 7 5800H with Radeon Graphics bits: 64 type: MT MCP
arch: Zen 3 gen: 4 built: 2021-22 process: TSMC n7 (7nm) family: 0x19 (25)
model-id: 0x50 (80) stepping: 0 microcode: 0xA50000C
Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
L3: 16 MiB desc: 1x16 MiB
Speed (MHz): avg: 2536 high: 3970 min/max: 1200/4462 boost: enabled
scaling: driver: acpi-cpufreq governor: performance cores: 1: 1474 2: 1397
3: 3459 4: 3453 5: 3434 6: 3433 7: 2401 8: 3520 9: 2753 10: 1905 11: 1396
12: 1396 13: 1396 14: 1734 15: 3456 16: 3970 bogomips: 102211
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities:
Type: itlb_multihit status: Not affected
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: mmio_stale_data status: Not affected
Type: spec_store_bypass
mitigation: Speculative Store Bypass disabled via prctl
Type: spectre_v1
mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
STIBP: always-on, RSB filling
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: AMD Navi 14 [Radeon RX 5500/5500M / Pro 5500M]
vendor: Micro-Star MSI driver: amdgpu v: kernel arch: RDNA 1
process: TSMC n7 (7nm) built: 2019-20 pcie: gen: 3 speed: 8 GT/s
lanes: 16 ports: active: HDMI-A-1 empty: none bus-ID: 03:00.0
chip-ID: 1002:7340 class-ID: 0380
Device-2: AMD Cezanne vendor: Micro-Star MSI driver: amdgpu v: kernel
arch: GCN 5.1 process: TSMC n7 (7nm) built: 2018-21 pcie: gen: 3
speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s ports:
active: eDP-1 empty: none bus-ID: 07:00.0 chip-ID: 1002:1638
class-ID: 0300
Device-3: Acer HD Webcam type: USB driver: uvcvideo bus-ID: 1-4:4
chip-ID: 5986:211b class-ID: 0e02
Display: x11 server: X.Org v: 21.1.3 with: Xwayland v: 22.1.2
compositor: kwin_x11 driver: X: loaded: amdgpu unloaded: modesetting,radeon
alternate: fbdev,vesa gpu: amdgpu display-ID: :0 screens: 1
Screen-1: 0 s-res: 3840x1080 s-dpi: 96 s-size: 1013x285mm (39.88x11.22")
s-diag: 1052mm (41.43")
Monitor-1: HDMI-A-1 mapped: HDMI-A-1-0 pos: right model: HP 2159
serial: <filter> built: 2009 res: 1920x1080 hz: 60 dpi: 102 gamma: 1.2
size: 479x269mm (18.86x10.59") diag: 549mm (21.6") ratio: 16:9 modes:
max: 1920x1080 min: 720x400
Monitor-2: eDP-1 mapped: eDP pos: primary,left model: AU Optronics 0x80ed
built: 2017 res: 1920x1080 hz: 144 dpi: 142 gamma: 1.2
size: 344x193mm (13.54x7.6") diag: 394mm (15.5") ratio: 16:9 modes:
max: 1920x1080 min: 640x480
OpenGL: renderer: AMD RENOIR (LLVM 13.0.1 DRM 3.46 5.18.5-zen1-1-zen)
v: 4.6 Mesa 22.1.2 direct render: Yes
Audio:
Device-1: AMD Navi 10 HDMI Audio vendor: Micro-Star MSI
driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
bus-ID: 03:00.1 chip-ID: 1002:ab38 class-ID: 0403
Device-2: AMD Renoir Radeon High Definition Audio vendor: Micro-Star MSI
driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
link-max: gen: 4 speed: 16 GT/s bus-ID: 07:00.1 chip-ID: 1002:1637
class-ID: 0403
Device-3: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Micro-Star MSI
driver: snd_rn_pci_acp3x v: kernel
alternate: snd_pci_acp3x,snd_pci_acp5x,snd_pci_acp6x,snd_acp_pci,snd_sof_amd_renoir
pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s
bus-ID: 07:00.5 chip-ID: 1022:15e2 class-ID: 0480
Device-4: AMD Family 17h/19h HD Audio vendor: Micro-Star MSI
driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
link-max: gen: 4 speed: 16 GT/s bus-ID: 07:00.6 chip-ID: 1022:15e3
class-ID: 0403
Sound Server-1: ALSA v: k5.18.5-zen1-1-zen running: yes
Sound Server-2: PulseAudio v: 16.0 running: no
Sound Server-3: PipeWire v: 0.3.52 running: yes
Network:
Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: Micro-Star MSI driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
lanes: 1 port: f000 bus-ID: 04:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Device-2: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel pcie: gen: 2
speed: 5 GT/s lanes: 1 bus-ID: 05:00.0 chip-ID: 8086:2723 class-ID: 0280
IF: wlp5s0 state: down mac: <filter>
Bluetooth:
Device-1: Intel AX200 Bluetooth type: USB driver: btusb v: 0.8
bus-ID: 3-3:2 chip-ID: 8087:0029 class-ID: e001
Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Drives:
Local Storage: total: 476.94 GiB used: 105.06 GiB (22.0%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Micron
model: 2210 MTFDHBA512QFD size: 476.94 GiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: P6MA001 temp: 37.9 C scheme: GPT
Partition:
ID-1: / raw-size: 476.64 GiB size: 476.64 GiB (100.00%)
used: 105.06 GiB (22.0%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 576 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 476.64 GiB size: 476.64 GiB (100.00%)
used: 105.06 GiB (22.0%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-4: /var/log raw-size: 476.64 GiB size: 476.64 GiB (100.00%)
used: 105.06 GiB (22.0%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 476.64 GiB size: 476.64 GiB (100.00%)
used: 105.06 GiB (22.0%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 15.01 GiB used: 768 KiB (0.0%)
priority: 100 dev: /dev/zram0
Sensors:
System Temperatures: cpu: 50.0 C mobo: N/A
Fan Speeds (RPM): N/A
GPU: device: amdgpu temp: 40.0 C device: amdgpu temp: 42.0 C mem: 0.0 C
fan: 65535 watts: 7.00
Info:
Processes: 377 Uptime: 5h 22m wakeups: 2 Memory: 15.02 GiB
used: 4.91 GiB (32.7%) Init: systemd v: 251 default: graphical
tool: systemctl Compilers: gcc: 12.1.0 clang: 13.0.1 Packages: pacman: 1767
lib: 509 Shell: fish v: 3.4.1 default: Bash v: 5.1.16 running-in: konsole
inxi: 3.3.18
Garuda (2.6.4-1):
System install date:     2022-06-21
Last full system update: 2022-06-22
Is partially upgraded:   No
Relevant software:       NetworkManager
Windows dual boot:       No/Undetected
Snapshots:               Snapper
Failed units:

the easy way, is to invoke /bin/bash first.
ie
$ /bin/bash
$ source ./shellscript.sh
Or ./shellscript.sh (I forget...don't need to run scripts much anymore)
Or my method, /bin/chsh -s /bin/bash and just run bash and forget friggin fish all together.

1 Like

Using octopi was the right thing to do.

Also do not convert the bashrc to fish.
Your .bashrc will be processed at start of the terminal, ie the easiest thing to reload it is to start a new terminal window. Then the environment will be set and fish active.

If you need to run a bash script, just manually run it with bash, ie instead of ./script type bash script.

3 Likes

Thank you both for your reply.

I restored the .bashrc back to its original contents and opened a new terminal window to reload it, but fish was still complaining about a command not found in the anaconda section. A bit more digging helped me to discover that when initializing anaconda, I can (must?) specify which shell I'm using. Thankfully, fish is among the recognized shells.

After doing that, and again reloading konsole, I have a working conda command.

Also, I'm glad to know that using octopi was the right thing to do. Cheers!