listsedshluac

I just want list my *.lua file and luac it to *.ttt


I just want list my *.lua file and luac it to *.ttt

my buildData.sh like this

findLua()
{

for file in $(find $PWD -name "*.lua")
do
    local dirname=$(dirname "$file")
    local filename=$(basename "$file")
    local fuName=$dirname"/"${filename%.*}

    local outPath = $fuName | sed "s/.*Lua\/\(.*\)/\1/"
    echo $fuName | sed "s/.*Lua\/\(.*\)/\1/"  #echo the absolute path is right
    echo $outPath #the echo nothing why?
    $LUACTOOL -o $TEMPDIR$outPath.ttt $file
    echo out$TEMPDIR$outPath.ttt
done
}    

this line:

 local outPath = $fuName | sed "s/.*Lua\/\(.*\)/\1/" 

got null but I echo $fuName | sed "s/.Lua/(.)/\1/" the print is right why this?anyone can help me?


Solution

  • You wanted to store the output of a command into a variable. Use the correct syntax:

    local outPath=$( echo $fuName | sed "s/.*Lua\/\(.*\)/\1/" )