Skip to content

Instantly share code, notes, and snippets.

@churchers
Last active August 21, 2020 13:40
Show Gist options
  • Save churchers/51ae4aecb22a33b2025e0653d34e6be6 to your computer and use it in GitHub Desktop.
Save churchers/51ae4aecb22a33b2025e0653d34e6be6 to your computer and use it in GitHub Desktop.
Library for simple agi scripts in shell (FreeBSD)
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}\""
}
#!/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