Wie wechsle ich zwischen Bash und Fish?
Du kannst dauerhaft und schnell zwischen Bash und Fish wechseln, indem du das Toggle-Shell-Skript nutzt. Dieses Werkzeug für das Terminal liest deine aktuelle Standard-Shell aus, ändert sie dauerhaft im System und startet direkt die neue Shell im selben Fenster, ohne dass du das Terminal neu starten musst.
Unter GNUSlashLinux nutzt das Skript standardmäßig folgende Shell-Pfade:
Nutzung
Gib im Terminal einfach den folgenden Befehl ein, um die Shell zu wechseln:
toggle-shell
Das Skript nutzt den Befehl chsh, um die Standard-Shell in der Systemdatei /etc/passwd für deinen Benutzer anzupassen, und exec, um die aktuelle Terminalsitzung ohne Fensterneustart zu ersetzen.
#!/bin/sh
# Ermittelt die aktuell als Standard gesetzte Shell für den aktuellen Benutzer
# (Extrahiert den Pfad aus der /etc/passwd)
CURRENT_DEFAULT=$(getent passwd "$USER" | cut -d: -f7)
# Pfade zu den Shells definieren
BASH_PATH="/usr/bin/bash"
FISH_PATH="/usr/bin/fish"
if [ "$CURRENT_DEFAULT" = "$FISH_PATH" ]; then
echo "Aktuelle Standard-Shell ist Fish."
echo "Wechsle dauerhaft zu Bash..."
# Ändert die Standard-Shell und startet sie sofort im aktuellen Fenster
chsh -s "$BASH_PATH" && exec bash
else
echo "Aktuelle Standard-Shell ist Bash."
echo "Wechsle dauerhaft zu Fish..."
# Ändert die Standard-Shell und startet sie sofort im aktuellen Fenster
chsh -s "$FISH_PATH" && exec fish
fi
How do I switch between Bash and Fish?
You can permanently and quickly switch between Bash and Fish by using the toggle-shell script. This terminal utility detects your current default shell, permanently changes it in the system, and immediately launches the new shell within the same window without needing to restart the terminal.
Under GNUSlashLinux, the script uses the following default shell paths:
Usage
Simply type the following command in your terminal to switch your shell:
toggle-shell
The script utilizes the chsh command to update the default shell in the /etc/passwd system file for your user, and exec to replace the current terminal session without needing to restart the window.