Project

General

Profile

« Previous | Next » 

Revision 1953

Scripts that are meant to be run in the calling shell: Fixed bug where running the script inside another script would make the script think it was being run as a program, and abort with a usage error

View differences:

bin/stop_imports
6 6
    local self="${BASH_SOURCE[0]}"
7 7
    local selfDir="$(dirname -- "$self")"
8 8
    
9
    if test "${BASH_LINENO[@]: -1}" = 0; then # was run without initial "."
9
    if test "${BASH_LINENO[1]}" = 0; then # was run without initial "."
10 10
        echo "Usage: . $self (note initial \".\")"|fold -s >&2
11 11
        return 2
12 12
    fi
bin/with_all
8 8
    local selfDir="$(dirname -- "$self")"
9 9
    
10 10
    # Was run without initial ".", or with insufficient parameters
11
    if test "${BASH_LINENO[@]: -1}" = 0 -o "$#" -lt 1; then
11
    if test "${BASH_LINENO[1]}" = 0 -o "$#" -lt 1; then
12 12
        echo "Usage: . $self make_target (note initial \".\")"|fold -s >&2
13 13
        return 2
14 14
    fi
bin/import_all
6 6
    local self="${BASH_SOURCE[0]}"
7 7
    local selfDir="$(dirname -- "$self")"
8 8
    
9
    if test "${BASH_LINENO[@]: -1}" = 0; then # was run without initial "."
9
    if test "${BASH_LINENO[1]}" = 0; then # was run without initial "."
10 10
        echo "Usage: . $self (note initial \".\")"|fold -s >&2
11 11
        return 2
12 12
    fi
bin/env_password
11 11
    test "$1" = - && { store=1; shift;}
12 12
    
13 13
    # Was run without initial ".", or with insufficient parameters
14
    if test "${BASH_LINENO[@]: -1}" = 0 -o "$#" -lt 1; then
14
    if test "${BASH_LINENO[1]}" = 0 -o "$#" -lt 1; then
15 15
        echo "Usage: . $self env_var [desc] (note initial \".\")"|fold -s >&2
16 16
        return 2
17 17
    fi

Also available in: Unified diff