Situation: Need to login to multiple remote servers with some of them having fish shell
Requirement: Default shell is bash. If I login to a server and fish is present, switch to fish shell, otherwise stay on bash.
Tried .bashrc:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Source global definitions
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
# Update Path
export PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH:$HOME/.bin
# Open fish shell if present, otherwise stick to bash
if hash fish 2>/dev/null; then
# echo "Fish detected, shifting shell"
fish "$@"; exit
fi
However, scp doesn't seem to be working. When I try to scp a file, verbose output shows it to be stuck here.
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_ADDRESS = en_US.UTF-8
debug1: Sending env LC_IDENTIFICATION = en_US.UTF-8
debug1: Sending env LC_MEASUREMENT = en_US.UTF-8
debug1: Sending env LC_MONETARY = en_US.UTF-8
debug1: Sending env LC_NAME = en_US.UTF-8
debug1: Sending env LC_NUMERIC = en_US.UTF-8
debug1: Sending env LC_PAPER = en_US.UTF-8
debug1: Sending env LC_TELEPHONE = en_US.UTF-8
debug1: Sending env LC_TIME = en_US.UTF-8
debug1: Sending command: scp -v -f test_file
Initially I thought the echo command was causing it to not work, but it doesn't work without it as well.