This is as a Lab Notebook which describes how to solve a specific problem at a specific time. Please keep this in mind as you read and use the content. Please pay close attention to the date, version information and other details.
Changing your shell on HPCC, particularly your login shell, is not recommended. We only support bash and much of our system, particularly the module system and job scheduler, is set to work with bash. Additionaly, external software (such as VScode) may break with an alternative shell
Using an Alternative Linux Shell on HPCC
HPCC only supports bash, but if you would like to use an alternative shell, you may do so at your own risk. Please keep in mind the above warning before your proceed, and if you require help to restore the regular bash shell, please contact HPCC support
Before you change your shell...
While your default login shell on HPCC is bash, this does not mean you are limited to only running bash shell scripts.
Shell scripts are simply text files with series of commands that are a mix of programs that are on the system (grep, date, time, a python program, your program, and 'built-ins' specific to the shell) and syntax for control statements like loops and if specific to the shell in which you are running.
Shell scripts typically have a program that runs then, known as the interpreter, which could include a shell (bash, zsh, etc) or a language interpreter (python, Rscript, ruby, julia etc).
You can run a shell script in (at least) two ways:
1. Run with an interpreter
Using an interpreter to run you shell script typically follows this syntax
<interpereter> <options> <path/to/script>
A familiar example using python would be:
However, the same can be done with different shells:
While HPCC only supports the bash shell for operations as the module system is written for bash, if you have shell scripts written for the zsh shell, you can still run those using this method on the command line or even inside another bash script (such as a script to launch a job with SLURM).
2. Using the 'shebang'
At the top of any script you run on a Linux system like the hPC, you may include what's known as the "shebang" line (which must be the first line, for more information, see the Wikipedia page).
The general syntax for this line is
Examples of the 'shebang' in use include:
1 2 3 4 5 6 7 8 9
A further explanation of why you might use
/usr/bin/env for your python or R scripts can be found here.
To launch a script with a shebang, you must also change the permissions to allow execution (
+x ) if that is not already set with
chmod u+x my_shell_script.sh which gives you permission to run the script.
If you still find it necessary to change your shell, see below for instructions on how to do so as well as important notes about setting environment variables and making startup scripts for different shells.
Changing your shell
Several common shell choices are available on HPCC:
bash: a Bourne-shell (sh) compatible shell with many newer advanced features as well
tcsh: an advanced variant on
cshwith all the features of modern shells
zsh: an advanced shell which incorprates all the functionality of
csh: the original C-style shell
You can change you login shell with the
Assigning Environment Variables
To assign a new value to an environment variable in
zsh, you use the same format as
To assign a new value to an environment variable in either
setenv <name> <value>
A startup script is a shell script which the login process executes. It provides an opportunity to alter your environment. You are free to setup your own startup scripts but be careful to make sure they are set up correctly for both interactive and batch access or it may negatively affect your ability to log in or run batch jobs on the system. Below are startup scripts for each shell: