Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is it possible to use another shell for scripts than for standard terminal use?

The problem is, i use fish as shell at the moment and i find i very convenient. But i would like to learn a bit of shell programming in Ubuntu. Since there are differences between those two it would be nice, to work with fish and bash at the same time, perhaps in different terminal windows? i know i can write a shell script and have to put the interpreter in the beginning. But for testing developing at commandline i would find it useful to fast switch between shells or use two different terminal windows with different shells in one session at the same time?

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

Yes, like takkat said you can start gnome-terminal, or xterm, or konsole in kde or press Ctrl+Alt+F1 or Ctrl+Alt+F2 or Ctrl+Alt+F3, etc.. All by default use bash but you can have fish opened along side with them as well.

To have any of the 2 do this:

gnome-terminal -e bash (To start gnome-terminal with bash)
gnome-terminal -e fish (To start gnome-terminal with fish)

share|improve this answer
    
i have set fish as my standard shell, so when i open a terminal fish is instantly activated? do i have to manually switch back to bash? how can i do that? –  NES Jan 3 '11 at 21:23
    
mh, i'm not sure if this worked. tried gnome-terminal -e bash and it opens a new terminal that looks like bash. but when i use echo $SHELL it prints /usr/bin/fish? –  NES Jan 3 '11 at 21:41
    
$SHELL is your system variable that you set to 'fish' by making it your standard shell –  Takkat Jan 3 '11 at 21:44
    
Because $SHELL gets the one set in the environment. Not the one used right now. For me it shows bash for example even though am typing it from fish. –  Luis Alvarado Jan 3 '11 at 21:44
    
ah ok, thanks. can i somehow add an argument to gnome-terminal -e so that it uses colors again. as it would do if i had activated bash globally in the environment? –  NES Jan 3 '11 at 21:50
show 1 more comment

You can switch to any installed shell by running it at the command line. This applies to bash, ksh, ash, dash, fish, csh, etc. These will inherit the login environment from the original shell.

Starting an interactive session as a login session will use the shell from your login. You need to change your shell between starting sessions if you want different login sessions.

For your purposes, I would just open an a second window and replacing the shell with the command exec /bin/bash -i.

share|improve this answer
add comment

You can easily start two terminal windows by typing

gnome-terminal

in your fish shell.

In case you changed your standard shell to 'fish' proceed as CYREX suggested.

share|improve this answer
    
yes, but they both use fish then. i'd like one using fish the other bash. –  NES Jan 3 '11 at 21:20
    
In a standard Ubuntu installation gnome-terminal is not replaced by fish. Did you change that after having installed fish? Can you exit fish to gnome-terminal? –  Takkat Jan 3 '11 at 21:31
    
yes, i did, but i don't know how to temporarily switch back or just open one terminal-window with fish the other with bash. as far as i understood the chsh manpage. chsh changes the shell global for the user? –  NES Jan 3 '11 at 21:35
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.