You can change your shell temporarily by creating a sub-shell and using that instead of the original shell. You can create a sub-shell using any shell available on your UNIX system. This means that you can look in the /etc/shells file and use a shell listed there, or you can use a shell installed elsewhere on the system (Code Listing 3.6).
To find out which temporary shells you can use:
1. | cat /etc/shells At the shell prompt, type cat /etc/shells to find out which shells are listed in the shells file. If you don't find a shell you want to use in the shells file, look for other shells installed elsewhere on the system. |
2. | ls /usr/local/bin *sh At the shell prompt, type ls /usr/local/bin *sh to find additional shells in the /usr/local/bin directory. Note that not all programs that end with sh are shells, but most shells end with sh (Code Listing 3.6). |
To create a temporary shell (sub-shell):
/usr/bin/csh
[ejr@hobbes]$ cat /etc/shells /bin/bash /bin/sh /bin/tcsh /bin/csh [ejr@hobbes]$ ls /usr/local/bin/*sh /usr/local/bin/pdksh [ejr@hobbes]$ |
[ejr@hobbes]$ /usr/bin/csh ejr> |
To exit a temporary shell (sub-shell):
exit
Tip
Using temporary shells is a great way to experiment with other shells and their options. We'd recommend using a temporary shell to experiment with the shells covered in this chapter.
Tip
You can also often use to exit from a sub-shell, but this depends on the system configuration. Try it out and see!
Tip
See Chapter 1 and the listings of directories containing programs for other places to look for shells.
3.21.93.44