Project

General

Profile

Download (513 Bytes) Statistics
| Branch: | Tag: | Revision:

haketilo / shell_utils.sh @ 90896bcf

1
# Copyright (C) 2021 Wojtek Kosior
2
# Redistribution terms are gathered in the `copyright' file.
3

    
4
# This file is meant to be sourced in sh.
5

    
6
ENDL="
7
"
8

    
9
errcho() {
10
    echo "$@" >&2
11
}
12

    
13
map_set_instr() {
14
    echo "$1__$2='$3'"
15
}
16

    
17
map_set() {
18
    eval "$(map_set_instr "$@")"
19
}
20

    
21
map_set_export() {
22
    eval "export $(map_set_instr "$@")"
23
}
24

    
25
map_get() {
26
    eval "echo \"\$$1__$2\""
27
}
28

    
29
map_del_instr() {
30
    echo "unset $1__$2"
31
}
32

    
33
map_del() {
34
    eval "$(map_del_instr "$@")"
35
}
36

    
37
sanitize() {
38
    echo "$1" | tr /.- _
39
}
(8-8/8)