Project

General

Profile

« Previous | Next » 

Revision 11432

lib/sh/util.sh: added require_dot_script()

View differences:

lib/sh/util.sh
127 127

  
128 128
is_dot_script() { echo_func; test "${BASH_LINENO[${#BASH_LINENO[@]}-1]}" != 0; }
129 129

  
130
require_dot_script() # usage: require_dot_script || return
131
{
132
	echo_func
133
	if ! is_dot_script; then # was run without initial "."
134
		echo "usage: . $top_script (note initial \".\")"|fold -s >&2
135
		return 2
136
	fi
137
}
138

  
130 139
sys_cmd_path() { echo_func; echo_builtin command -p which "$1"|echo_stdout; }
131 140

  
132 141
# makes command in $1 a system command

Also available in: Unified diff