When I paste multiple commands into putty window,
commands stop executing after first sudo
.
Why?
My clipboard (I'm careful to copy also newline after the 2nd command)
sudo -u smith echo aaaaaaaa ;
echo bbbbbbbb ;
Result:
$ sudo -u smith echo aaaaaaaa ;
echo bbbbbbbb ;
aaaaaaaa
$
It executes echo aaaaaaaa
as expected, but 2nd command is not executed.
Setup: I connect from windows 10 via putty to red hat server, shell is bash.
debugging attempt
Seems sudo
hijacks pasted input somehow. (-n
option does not help)
# Given clipboard:
sleep 5s
echo bbbbbb
# Result is:
$ sleep 5s
$ echo bbbbbb # <-- this line gets onto screen AFTER sleep has finished
bbbbbb
But if sleeping is done with sudo
Given clipboard:
sudo -u smith sleep 5s
echo bbbbbb
# Result is:
$ sudo -u smith sleep 5s
echo bbbbbb # <-- this line gets onto screen BEFORE sleep has finished