Difference between revisions of "Shells"

From Mu2eWiki
Jump to navigation Jump to search
Line 4: Line 4:
 
==Setup scripts==
 
==Setup scripts==
 
*'''~/.bash_profile''' is executed once when you login.   
 
*'''~/.bash_profile''' is executed once when you login.   
** When you first get a mu2e account, you will be given an [[example|ExampleBashProfile]] which should only contain the following modifications
+
** When you first get a mu2e account, you will be given an [[ExampleBashProfile|example]] which should only contain the following modifications
 
** It should source a "products/.../setup.sh" command (see details [[https://mu2ewiki.fnal.gov/wiki/CodeRecipe|here]] which defines the PRODUCTS environmental, which allows you to access UPS products
 
** It should source a "products/.../setup.sh" command (see details [[https://mu2ewiki.fnal.gov/wiki/CodeRecipe|here]] which defines the PRODUCTS environmental, which allows you to access UPS products
 
** source ~/.bashrc
 
** source ~/.bashrc
 
*'''~/.bashrc''' is executed for interactive non-login shells
 
*'''~/.bashrc''' is executed for interactive non-login shells
**When you first get a mu2e account, you will be given an [[example|ExampleBashrc]] which would usually be modified
+
**When you first get a mu2e account, you will be given an [[ExampleBashrc|example]] which would usually be modified
 
** set the prompt
 
** set the prompt
 
** set any aliases
 
** set any aliases

Revision as of 22:39, 21 September 2017

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
  • 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: