Running Unix Shell Commands

Foreground & Background Processes

Normally, commands are run in the foreground

Running a process in the background

Job Control Viewing process status

Killing a job

  • can specify signal

  • Command Line Editing

    Editing the Current Line

    Your account is setup to use vi editing mode.

    At prompt, start out in insert mode.

    Press <ESC> key to enter control mode

    Editing Previous Lines

    You may also edit commands stored in your $HISTORY file


    Shell Scripts

    Simple Shell Scripts

    A shell script is a file that contains commands to be executed by the shell.

    You need to make the file executable with chmod

    .profile

    Executed automatically when you login, this customizes your shell environment with

    Aliases

    Aliases let you define a shorthand for shell commands that you use frequently

    Options

    Options are set either on or off

    Option Description Default
    bgnice run bg jobs at low priority on
    ignoreeof don't logoff with ^D off
    noclobber don't allow overwrite with > off
    noglob don't expand file wildcards off
    nounset using undefined variable produces error off

    User-Created Variables

    You can make up variables to represent useful string values

    Quoting

    How a string is represented determines how the shell interprets it

    Keyword Shell Variables

    Built-in variables have specific meaning to the Unix shell. They generally use all caps.

    Environment Shell Variables

    Carry over to all sub-processes

    Read-Only Shell Variables

    Some variables may only be read by shell scripts