File: env.txt

package info (click to toggle)
ksh93u%2Bm 1.0.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,744 kB
  • sloc: ansic: 142,757; sh: 33,435; makefile: 32
file content (66 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /usr/bin/ksh
# shell version of env command
case $(getopts '[-]' opt '--???man' 2>&1) in
version=[0-9]*)
    usage=$'[-?@(#)env (AT&T Labs Research) 1999-05-20\n]
        [-author?David Korn <dgkorn@gmail.com>]
        [-license?http://www.research.att.com/sw/tools/reuse]
        [+NAME?env - set environment for command invocation]
        [+DESCRIPTION?\benv\b modifies the current environment according
		to the \aname\a\b=\b\avalue\a arguments, and then
		invokes \acommand\a with the modified environment.]
	[+?If \acommand\a is not specified, the resulting environment
		is written to standard output quoted as required for
		reading by the \bsh\b.]
	[i:ignore-environment?Invoke \acommand\a with the exact environment
		specified by the \aname\a\b=\b\avalue\a arguments; inherited
		environment variables are ignored.  As an obsolete feature,
		\b-\b by itself can be specified instead of \b-i\b.]
	[u:unset]:[name?Unset the environment variable \aname\a if it was
		in the environment.  This option can be repeated to unset
		additional variables.]

	[name=value]... [command ...]

	[+EXIT STATUS?If \acommand\a is invoked, the exit status of \benv\b
		will be that of \acommand\a.  Otherwise, it will be one of
		the following:]{
	        [+0?\benv\b completed successfully.]
	        [+126?\acommand\a was found but could not be invoked.]
	        [+127?\acommand\a could not be found.]
	}
        [+SEE ALSO?\bsh\b(1), \bexport\b(1)]
    '
    ;;
*)
    usage='iu:[name] [name=value]... [command ...]'
    ;;
esac
clear=
while	getopts  "$usage" var
do	case $var in
	i)	clear=1;;
	u)	command unset $OPTARG 2> /dev/null;;
	esac
done
#[[ $var == "" ]] || exit 1
shift $((OPTIND-1))
if	[[ $1 == - ]]  # obsolete form
then	clear=1
	shift
fi
if	[[ $clear == 1 ]]
then	typeset +x $(typeset +x)
fi
while	true
do	case $1 in
	*=*)	export "$1";;
	*) break;;
	esac
	shift
done
if	(( $# >0 ))
then	exec "$@"
else	export
	exit 0
fi