Customize_Shell

Running the command or script at the shell prompt, the Bourne shell creates a new instance of the shell for the command or script to run it. This makes it easy to suspend execution of a program or script to move it into the background.

eof

|^|

Partial used files and terms

SHELL ENVIRONMENT

/etc/profile, env, export, set, unset, ~/.bash_profile, ~/.bash_login, ~/.profile, ~/.bashrc, ~/.bash_logout, function, alias, list

SIMPLE SCRIPTS

for, while, test, if, read, seq

Shell Configuration Files

When a shell starts, it reads configuration files that help to configure the operating environment for the shell. Understanding the configuration files used by the Bourne shell is particularly important because most other shells maintain backward compatibility with the Bourse shell and will process its configuration files if they are present. Bourne shell configuration directives reside in two files. System wide configuration is done in the /etc/profile file.

System wide settings examples:

  • default executable search path

  • default prompt settings

  • default user limits (ulimit)

In order to make it easy for software packages to safety make additions to the shell configuration file, Linux systems also parse scripts found in the /etc/profile.d directory. To accomplish this, the system /etc/profile contains a block of code that will incorporate scripts that end with a particular extension.

Guide Howto run shell scripts

Bourne sh: Configuration Files

/etc/profile - system wide

  • /etc/profile.d/

~/.profile - per user

SCRIPT EXECUTION

Spawn a new shell and run script_name in it:

  • ./script_name

Run script_name in the current shell:

  • source script_name

  • .script_name