Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like to change the default shell in each terminal emulator separately. To clarify, I want Xterm to use TCSH, pterm to use pysh, gnome-terminal to use BASH, etc. Is this possible? If so, how can this be accomplished.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Each terminal emulator has its custom way to select which shell to run:

  • gnome-terminal has the run a custom command instead of my shell field in the profile editor.
  • xterm (and pterm) uses xrdb database to store its configuration but do not allow to configure the command to run. You could write a simple shell script that wraps the xterm executable to give him an executable parameter.
  • konsole has the command field in the profile editor.

So you need to discover, by reading the manual, how (and if) each terminal emulator can be configured. There is no common way :-(

If you need only a simple way to choose which shell to run, I strongly suggest you to choose a terminal emulator that supports profiles (like gnome-terminal) and to create a different profile for each shell type. This way you'll can launch a new tab or window running the needed shell by the gnome-terminal internal menu (and, as bonus, choose a different text color for each shell).

share|improve this answer
add comment

As a quick and contained solution, you could make a wrapper script.

case "$1" in
   xterm) shell=/bin/tcsh ;;
   pterm) shell=/bin/pysh ;;
   gnome-terminal) shell=/bin/bash ;;
   *)
       printf "Not supported: %s" "$1"
       exit 1
       ;; 
esac
SHELL=$shell $1

Just use it as such: thescript <terminal_emulator>.

It's generally preferable to configure each terminal emulator individually though.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.