1

How can I make my bash return a value for Lua script read function? If I run script from terminal - output is correct but from lua script I got nil value.

lua: action.lua:18: attempt to index local 'findKeyInDB' (a nil value)

 local findKeyInDB = io.open('sh /home/linux/db.sh 15541993')
 local output = findKeyInDB:read("*a") 

Bash:

#!/bin/sh
key=$1
myvariable=$(echo "SELECT id,dkey FROM telegram_keys WHERE dkey="$key"" | mysql -N gamdom_database -u root -ppasswrd)
echo "$myvariable"
Little Fox
  • 1,212
  • 13
  • 39

0 Answers0