1

I would like to get some practice using different shells (zsh and ksh, etc...) What is the best way to set it up so I can create a shortcut that will launch a terminal with the desired shell? I'd rather not set up another account or have to chsh each time if possible, but would love to see all my options. As a bonus I would love to see links to resources for learning various different shells.

Scott Goodgame
  • 2,636
  • 15
  • 20

1 Answers1

1

The shortcuts would depend on what terminal you are using. However, most accept the -e option to specify what program to run. Therefore, for zsh you could do:

x-terminal-emulator -e zsh

Or, this approach to have a login shell:

x-terminal-emulator -e 'zsh -l'

You could then add these as aliases on your default shell or, if you prefer to have a launcher on Ubuntu's dash, create a file inside ~/.local/share/applications with the extension .desktop and these lines:

[Desktop Entry]
Name=Zsh-Terminal
Comment=Use zsh in the command line
Exec=zsh
Terminal=true
Icon=utilities-terminal
Type=Application

Make this file executable and drag it to the dash.

Read more about the difference between login and non login shell.

aguslr
  • 1,796
  • 1
    Instead of hardcoding gnome-terminal, try x-terminal-emulator instead. And you can do: gnome-terminal -e zsh instead of using SHELL. Better yet, if you're using one launcher per shell, simply specify the shell (Exec=zsh) and set Terminal=true. – muru Feb 12 '15 at 17:38
  • @muru, my first idea was to use your approach but then using -e zsh doesn't make it a login shell. Same thing when just using Exec=zsh in the .desktop file. I'll edit to add both options and also good point about using x-terminal-emulator. – aguslr Feb 12 '15 at 17:50
  • 1
    That depends on whether you have enabled login shells in your terminal emulator (you may have, I haven't, OP may or may not have). Use the -l option if that's a problem: Exec=zsh -l, or x-terminal-emulator -e 'zsh -l'. – muru Feb 12 '15 at 17:51
  • @muru, I did not know that, good call! I'll change it then. – aguslr Feb 12 '15 at 18:03