Shells

From Mu2eWiki
Revision as of 22:46, 21 September 2017 by Rlc (talk | contribs) (→‎Setup scripts)
Jump to navigation Jump to search

We use the bash linux shell exclusively for the interactive command line and shell scripting. In general, this is the most powerful shell and the professional's choice.

Setup scripts

  • ~/.bash_profile is executed once when you login.
    • When you first get a mu2e account, you will be given an example which should only contain the following modifications
    • It should source a "products/.../setup.sh" command (see details [[1]] which defines the PRODUCTS environmental, which allows you to access UPS products
    • source ~/.bashrc
  • ~/.bashrc is executed for interactive non-login shells
    • When you first get a mu2e account, you will be given an example which would usually be modified
    • set the prompt
    • set any aliases
    • a good style is to leave the example untouched except to source a separate file (such as ~/.mybashrc) with your customizations. This always makes it clear what you are adding.
  • we do not use ".login" or ".profile" which are variants for .bash_profile
  • we do not recommend setting up UPS packages in the bash login scripts since this can get confusing
  • the lab systems will also usually execute /etc/profile.d/*.sh and /etc/bashrc

Standards

  • scripts that intended to be executed by the average user at the command line, should be added to the user's path and can be named with no extension, so it looks built-in.
  • scripts that are used in complex packages, or for special purposes, such as in monitoring, should have extension ".sh"
  • scripts intended to be sourced should have the extension ".sh".

References

The Linux Documentation Project publishes a number of guides that are available online. We suggest: