Last active
August 21, 2020 13:40
-
-
Save churchers/51ae4aecb22a33b2025e0653d34e6be6 to your computer and use it in GitHub Desktop.
Library for simple agi scripts in shell (FreeBSD)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
agi::parse(){ | |
local IFS=":" | |
local key val | |
read key val | |
while [ -n "${key}" ]; do | |
export "${key#agi_}=${val# }" | |
read key val | |
done | |
} | |
agi::_run(){ | |
local _cmd="$1" | |
local _input | |
echo "${_cmd}" | |
read _input | |
} | |
agi::exec(){ | |
local _cmd="$1" | |
local _args="$2" | |
agi::_run "EXEC ${_cmd} \"${_args}\"" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. "/path/to/agi-lib.sh" | |
agi::parse | |
agi::exec "Set" "AGI_TEST_EXT=${extension}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment