Project

General

Profile

« Previous | Next » 

Revision 1978

disown_all: Updated to use main function, local vars, $self, etc. like other bash scripts run using "."

View differences:

bin/disown_all
1 1
#!/bin/bash
2 2
# Disowns all running jobs
3 3

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

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

  
12
for job in $(jobs|"$selfDir/jobspecs"); do disown -h $job; done # ignore SIGHUP
4
disown_all_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
    # Ignore SIGHUP
15
    for job in $(jobs|"$selfDir/jobspecs"); do disown -h $job; done
16
}
17
disown_all_main "$@"

Also available in: Unified diff