Luci sys.call does not accept the sed command

I am trying to remove the last char of the last line of a file using the

sed '$ s/.$//' tmp

Error
')' expected near '$'

local sys = require("luci.sys")
sys.call('sed '$ s/.$//' /var/log/message > /var/log/tmp')

Another issue that i had been facing if echo of" ( Double qoutes)

sys.call('echo " " ' )

sys.call('echo \" \" ')

None of the above would print a double qoute ( ")

Am i missing something?

Unbalanced quotes.

sys.call("sed '$ s/.$//' /var/log/message > /var/log/tmp")

The entire command sequence is passed to sh -c so you need to double quote:

sys.call('echo "\\""')
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.