Closed steelsnake closed 2 years ago
Yeah, I've noticed that one too sometimes. Will check it.
Would be nice if you could lend me a hand and run this command and post its output here:
loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p TTY | tail -1 | awk -F= '{print $2}'
If this yields the same Syntax error (or empty) please try loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p TTY | tail -1
. If you still get that error (or empty) please try loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p TTY
. And if even that fails, please provide just the output of loginctl
.
The command produces no output and no errors:
[17:05:37] jenni@wombat:~$ loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p TTY | tail -1 | awk -F= '{print $2}'
[17:06:07] jenni@wombat:~$
For reference, loginctl by itself produces this output when run from Konsole:
[17:06:07] jenni@wombat:~$ loginctl
SESSION UID USER SEAT TTY
1471 1000 jenni seat0
2101 1000 jenni seat0
2335 1000 jenni seat0
2457 1000 jenni seat0
2840 1000 jenni seat0
3 1000 jenni seat0
595 1000 jenni seat0
838 1000 jenni seat0
8 sessions listed.
Edited to add: I just went ahead and ran those under sudo as well, same output
Thanks. That explains why loginctl does not return a tty - it does not have it. Still wondering why that triggers the sh error...
omg... why have i never tried this before... the clue lies in the first three chars - /bin/sh is used to execute the command and that command seems to have syntax not supported by sh ....
If that command is run in /bin/sh you get the same error. Will have to rework that command to be sh-compatible.
Edit: Note for future self: change cmd to
CMDTMP=`loginctl | awk '/tty/ {print $1}'`; loginctl show-session $CMDTMP -p TTY | tail -1 | awk -F= '{print $2}'
@steelsnake Please try again after building from branch issue-180-fix-sh-error-on-loginctl-call / #182
Unsigned packages of that branch are available at https://www.dropbox.com/sh/qbqnkha5l93wu3o/AABgxe3hB7BFeXg9s0kgGwE2a?dl=0
The updated package indeed fixes the syntax error :)
Thanks, gonna merge that PR after work then.
Hey there :) Nothing drastic, as the sudo command still works, but when running "sudo bash" under Konsole I get this error: sh 1: Syntax error: "(" unexpected
Full debug log ( the error is about halfway down after "trying to get tty by loginctl":