(e)declare; (i)declare, add at{r,c,}
This commit is contained in:
parent
eeb337eb9a
commit
e230bbc1bf
1 changed files with 46 additions and 0 deletions
|
|
@ -448,6 +448,52 @@ c4.t.b "s" 0 "gw_is_localhost_f" "== hostname -f" test "0" == '"$(c4.gw_is_local
|
|||
c4.t.b "s" 0 "gw_is_localhost" "== hostname -s" test "0" == '"$(c4.gw_is_localhost `hostname -s`; echo "$?")"'
|
||||
c4.t.b "s" 0 "name" "!= moo" test "1" == '"$(c4.gw_is_localhost "moo"; echo "$?")"'
|
||||
|
||||
### ENVIRONMENT
|
||||
### - implicit scoping, lexical binding
|
||||
C4_TR='E'
|
||||
|
||||
### MAP
|
||||
### - two dimensional matricies
|
||||
C4_TR='M'
|
||||
|
||||
function c4.m.atr {
|
||||
local offset=$1; shift;
|
||||
local file=$1; shift;
|
||||
if test -r "$file" -a "$offset" -ge 0 2>/dev/null ; then
|
||||
awk "NR==$offset" <"$file"
|
||||
fi
|
||||
}
|
||||
|
||||
C4_AWK_OPTS=
|
||||
function c4.m.atc {
|
||||
local C4_AWK_OPTS="${C4_AWK_OPTS}"
|
||||
case "$1" in
|
||||
-*) C4_AWK_OPTS="$1"; shift; ;;
|
||||
esac
|
||||
|
||||
local offset=$1; shift;
|
||||
local file=$1; shift;
|
||||
|
||||
if test -r "$file" -a "$offset" -ge 0 2>/dev/null ; then
|
||||
awk $C4_AWK_OPTS "{print \$$offset}" <"$file"
|
||||
fi
|
||||
}
|
||||
|
||||
function c4.m.at {
|
||||
local C4_AWK_OPTS="${C4_AWK_OPTS}"
|
||||
case "$1" in
|
||||
-*) C4_AWK_OPTS="$1"; shift; ;;
|
||||
esac
|
||||
|
||||
local row=$1; shift;
|
||||
local col=$1; shift;
|
||||
local file=$1; shift;
|
||||
|
||||
if test -r "$file" -a "$row" -ge 0 -a "$col" -ge 0 2>/dev/null ; then
|
||||
awk $C4_AWK_OPTS "NR==$row{print \$$col}" <"$file"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
### IDENTITY
|
||||
### - bootstrapping
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue