CS155

CS155: Introduction to Unix

Fall 2017

Customization

See this page as a slide show

Shell Customization

CS155 Customization

Automatic scripts

What’s the syntax?

Environment Variables

Customization usually means setting environment variables.

    export var="value"
    export TZ="America/Denver"

Remember, all examples from now on are bash only.

Inheritance

Changing your PATH

To help the shell find programs directory /newbin, add it to the beginning of the environment variable PATH:

    export PATH="/newbin:$PATH"

Why did we use "double quotes" as opposed to 'single quotes'?

Changing your prompt

To change your interactive prompt, set the appropriate variable:

    PS1="$USER> "

Why didn’t we use export? That’s because this variable is private to the shell, and not for the user of other programs.

Creating new commands

To create a new command, use alias:

    alias hi="echo Howdy!"
    unalias hi
    alias h="history"
    alias mkx="chmod u+x"

umask

% rm -f x y
% umask ugo=rwx
% touch x
% umask u=rwx,g=r,o=
% touch y
% ls -l x y
-rw-rw-rw- 1 cs155 class 0 Feb 14 20:45 x
-rw-r----- 1 cs155 class 0 Feb 14 20:45 y

Modified: 2015-07-31T12:58

User: Guest

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building