Project

General

Profile

« Previous | Next » 

Revision 1952

Scripts that are meant to be run in the calling shell: Fixed bug where running the script as a program (without initial ".") wouldn't be able to call return in something that was not a function. Converted all code to a <script_name>_main method so that return would work properly again. Converted all variables to local variables.

View differences:

stop_imports
1 1
#!/bin/bash
2 2
# Stops all running imports
3 3

  
4
self="${BASH_SOURCE[0]}"
5
selfDir="$(dirname -- "$self")"
6

  
7
if test "${BASH_LINENO[0]}" = 0; then # was run without initial "."
8
    echo "Usage: . $self (note initial \".\")"|fold -s >&2
9
    return 2
10
fi
11

  
12
for job in $(jobs|grep -F 'make inputs/'|"$selfDir/jobspecs"); do
13
    kill $job
14
done
4
stop_imports_main ()
5
{
6
    local self="${BASH_SOURCE[0]}"
7
    local selfDir="$(dirname -- "$self")"
8
    
9
    if test "${BASH_LINENO[@]: -1}" = 0; then # was run without initial "."
10
        echo "Usage: . $self (note initial \".\")"|fold -s >&2
11
        return 2
12
    fi
13
    
14
    for job in $(jobs|grep -F 'make inputs/'|"$selfDir/jobspecs"); do
15
        kill $job
16
    done
17
}
18
stop_imports_main "$@"

Also available in: Unified diff