Commands that work in ssh don't work in commands page

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
toastgodsupreme
DD-WRT Novice


Joined: 14 Aug 2011
Posts: 20

PostPosted: Fri Jul 02, 2021 1:07    Post subject: Commands that work in ssh don't work in commands page Reply with quote
SSH:
Code:
foo=$(cat /tmp/www/clients.html | grep 'xx:xx:xx:xx:xx:xx\|yy:yy:yy:yy:yy:yy'); echo 'printing foo'; echo $foo

printing foo
assoclist xx:xx:xx:xx:xx:xx assoclist yy:yy:yy:yy:yy:yy


Command page in GUI:
Code:
foo=$(cat /tmp/www/clients.html | grep 'xx:xx:xx:xx:xx:xx\|yy:yy:yy:yy:yy:yy'); echo 'printing foo'; echo $foo

sh: eval: line 1: xx:xx:xx:xx:xx:xx: not found
sh: eval: line 2: assoclist: not found
printing foo


So what causes commands to fail in the command page that would otherwise work over SSH?
Sponsor
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14221
Location: Texas, USA

PostPosted: Fri Jul 02, 2021 2:27    Post subject: Reply with quote
Improper syntax, lack of escape characters, a number of reasons. And we have no idea what router or build this is failing on....
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
Anoopnk
DD-WRT Novice


Joined: 07 Jun 2021
Posts: 12

PostPosted: Fri Jul 02, 2021 19:35    Post subject: Reply with quote
There are few special characters that are not taken as is, probably because of HTML posting these special characters I guess. It especially fails when it's a multiline command.

You can save it to custom and run it if you want to run it in web GUI.
Quote:
sh /tmp/custom.sh
toastgodsupreme
DD-WRT Novice


Joined: 14 Aug 2011
Posts: 20

PostPosted: Sat Jul 03, 2021 1:20    Post subject: Reply with quote
kernel-panic69 wrote:
Improper syntax, lack of escape characters, a number of reasons. And we have no idea what router or build this is failing on....


As if that mattered. But I sorted it out, just escape chars. Was just a matter of sorting out the commands in CLI and then saving them in GUI instead of testing through GUI.
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14221
Location: Texas, USA

PostPosted: Sat Jul 03, 2021 1:32    Post subject: Reply with quote
Actually, the build version and date do matter, since the webUI commands interface was broken at one point; although one particular ticket I found was invalid because the person was using the wrong syntax to execute two consecutive commands. Glad you got it sorted out.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum