software:shell

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
software:shell [2019/01/14 08:58]
meesters
software:shell [2019/10/12 07:38]
meesters removed
Line 24: Line 24:
 | TENEX-C-Shell ​                 | ''​$ tcsh'' ​  | ''#​!/​bin/​tcsh'' ​       | | TENEX-C-Shell ​                 | ''​$ tcsh'' ​  | ''#​!/​bin/​tcsh'' ​       |
 | Z-Shell ​                       | ''​$ zsh'' ​   | ''#​!/​bin/​zsh'' ​        | | Z-Shell ​                       | ''​$ zsh'' ​   | ''#​!/​bin/​zsh'' ​        |
 +
 +<WRAP center round info 90%>
 +You may use any of these shells - be advised, however, that:
 +  * We only support Bash.
 +  * Some Cluster features (e.g. the environment exported by SLURM) might not be available.
 +</​WRAP>​
 +
 +If you choose to use a different shell - in this example ''​zsh''​ -- you can try this snippet (in ''​bash''​):​
 +
 +<code bash>
 +if [[ $- == *i* ]]; then
 +  if [[ "​$SLURM_CLUSTER_NAME"​ == ""​ ]]; then
 +    if [ -z ${SBASH+x} ]; then
 +        export SHELL=/​bin/​zsh
 +        exec /bin/zsh -l
 +    fi
 +  fi
 +fi
 +</​code>​
 +
 +It activates the ''​zsh'',​ e.g. upon login, when placed in the ''​.bashrc''​-file. Calling
 +<code zsh>
 +export SBASH=1 && bash
 +</​code>​
 +will let you return to ''​bash''​ at any time.
  
 ===== Best Practices ===== ===== Best Practices =====
  
-<WRAP center round important ​90%> +<WRAP center round info 90%> 
-This is a completely arbitrary list! We make no claim for it to be complete.+This is a completely arbitrary list - and only applicable to Bash! We make no claim for it to be complete.
 </​WRAP>​ </​WRAP>​
  
-  - //Always comment your script//\\ \\ This is a recommended practice which is not only applied to shell scripting but all other kinds of programming. Writing comments in a script helps you or some else going through your script understand what the different parts of the script do.\\ \\ For starters, comments are defined using the ‘#’ sign.+  - //Always comment your code//\\ \\ This is a recommended practice which is not only applied to shell scripting but all other kinds of programming. Writing comments in a script helps you or some else going through your script understand what the different parts of the script do.\\ \\ For starters, comments are defined using the ‘#’ sign.
   - //Make a script exit when it fails//\\ \\ Sometimes bash may continue to execute a script even when a certain command fails, thus affecting the rest of the script (may eventually result in logical errors). Use the line below to exit a script when a command fails: <code bash>#​let script exit if a command fails   - //Make a script exit when it fails//\\ \\ Sometimes bash may continue to execute a script even when a certain command fails, thus affecting the rest of the script (may eventually result in logical errors). Use the line below to exit a script when a command fails: <code bash>#​let script exit if a command fails
 set -o errexit ​ set -o errexit ​