44#
55
66OLLAMA_LIB_NAME=' Ollama Bash Lib'
7- OLLAMA_LIB_VERSION=' 0.45.3 '
7+ OLLAMA_LIB_VERSION=' 0.45.5 '
88OLLAMA_LIB_URL=' https://github.com/attogram/ollama-bash-lib'
99OLLAMA_LIB_DISCORD=' https://discord.gg/BGQJCbYVBa'
1010OLLAMA_LIB_LICENSE=' MIT'
@@ -1381,7 +1381,8 @@ ollama_model_random() {
13811381 printf ' %s\n' " $models " | shuf -n1
13821382 else # If shuf is unavailable, fall back to awk's srand().
13831383 # awk's built‑in random generator (more portable, but less uniform)
1384- printf ' %s\n' " $models " | awk ' BEGIN{srand()} {a[NR]=$0} END{if(NR) print a[int(rand()*NR)+1]}'
1384+ # printf '%s\n' "$models" | awk 'BEGIN{srand()} {a[NR]=$0} END{if(NR) print a[int(rand()*NR)+1]}'
1385+ printf ' %s\n' " $models " | awk ' NR>0 {a[NR]=$0} END{if(NR) print a[int(1+rand()*NR)]}'
13851386 fi
13861387}
13871388
@@ -1967,7 +1968,7 @@ ollama_lib_about() {
19671968 printf " %-25s : %s\n" " OLLAMA_LIB_TURBO_KEY" " $turbo_key_status "
19681969 printf " %-25s : %s\n" " OLLAMA_LIB_TIMEOUT" " $OLLAMA_LIB_TIMEOUT seconds"
19691970
1970- if ! _exists ' compgen' ; then _debug ' ollama_lib_about: compgen Not Found' ; return 1 ; fi
1971+ if ! _exists ' compgen' ; then _debug ' ollama_lib_about: compgen Not Found' ; return 0 ; fi
19711972
19721973 printf ' \nFunctions:\n\n'
19731974
@@ -2036,7 +2037,8 @@ _ollama_eval_sanity_check() {
20362037 local cmd=" $1 "
20372038 local first_word
20382039 read -r first_word _ <<< " $cmd"
2039- if [[ " $first_word " =~ ^[[:space:]]* [a-zA-Z_][a-zA-Z0-9_]* \(\) ]]; then
2040+ # if [[ "$first_word" =~ ^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*\(\) ]]; then
2041+ if [[ " $first_word " =~ ^[a-zA-Z_][a-zA-Z0-9_]* \(\) ]]; then
20402042 printf ' ✅ Valid start: function definition OK: %s\n' " $first_word "
20412043 return 0
20422044 fi
@@ -2096,7 +2098,7 @@ _ollama_eval_danger_check() {
20962098
20972099# Returns: 0 on Sandbox run, 1 on Abort, 2 on Request for dangerous mode
20982100_ollama_eval_permission_sandbox () {
2099- local cmd=" $cmd "
2101+ local cmd=" $1 "
21002102 printf ' \nRun command in sandbox (y/N/eval)? '
21012103 read -r permission
21022104 case " $permission " in
@@ -2105,7 +2107,6 @@ _ollama_eval_permission_sandbox() {
21052107 echo
21062108 printf ' Running command in a sandboxed environment...\n\n'
21072109 env -i PATH=" /bin:/usr/bin" bash -r -c " $cmd "
2108- # return $? # return sandboxed eval error status
21092110 return 0 # ran in sandbox
21102111 ;;
21112112 eval|EVAL)
@@ -2117,7 +2118,7 @@ _ollama_eval_permission_sandbox() {
21172118}
21182119
21192120_ollama_eval_permission_dangerous_eval () {
2120- local cmd=" $cmd "
2121+ local cmd=" $1 "
21212122 printf ' \nAre you sure you want to use the DANGEROUS eval mode? [y/N] '
21222123 read -r permission
21232124 case " $permission " in
0 commit comments