Sample Header Ad - 728x90

strange issue with aliases for zsh

3 votes
2 answers
280 views
I'm trying to create an alias in my .zshrc file for an SSH connection. The full command is this:
ssh -t pi@raspi5 "cd ~/C-progs/c_trials; exec \$SHELL -l"
The command is designed to open an SSH connection, cd to a chosen directory, and then start a login shell. I can execute this command perfectly well from the command line of Terminal, and it does exactly what it's supposed to do. The command is a bit to remember, so I decided to create an alias for it. I put the alias in ~/.zshrc:
alias sshrp5="ssh -t pi@raspberrypi5 "cd ~/C-progs/c_trials; exec \$SHELL -l""
Which is, IIUC, the *prescribed* way to create an alias under zsh. Unfortunately, zsh apparently does not like this alias:
source ~/.zshrc
sourceing ~/.zshrc with the above alias in it immediately closes the Terminal tab from which I attempted the source command!! Fortunately, I had 3 tabs open, otherwise I would have been **locked out** of Terminal!! Anybody know what I've done to offend the great and powerful zsh? :)
Asked by Seamus (5329 rep)
Feb 2, 2024, 08:45 AM
Last activity: Aug 30, 2024, 07:01 AM