I noticed that this command returns NO through ssh: > $ ssh user at host "if [ -t 1 ]; then echo YES; else echo NO; fi" > NO and YES when run locally (of course): > $ if [ -t 1 ]; then echo YES; else echo NO; fi > YES I can't find any command line option related to running command remotely in terminal. I think users intuitively expect commands to be run in terminal. Is something broken with my ssh setup? ssh on FreeBSD 10.1 Yuri
On 04/15/2015 08:48 AM, Yuri wrote:> I noticed that this command returns NO through ssh: > > $ ssh user at host "if [ -t 1 ]; then echo YES; else echo NO; fi" > > NO > and YES when run locally (of course): > > $ if [ -t 1 ]; then echo YES; else echo NO; fi > > YES > > I can't find any command line option related to running command remotely > in terminal.-o RequestTTY=yes I think users intuitively expect commands to be run in> terminal. > Is something broken with my ssh setup? > > ssh on FreeBSD 10.1 > > Yuri > _______________________________________________ > openssh-unix-dev mailing list > openssh-unix-dev at mindrot.org > https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
On 2015-04-15, Yuri <yuri at rawbw.com> wrote:> I can't find any command line option related to running command remotely > in terminal.-t, -T The term you are looking for is "tty".> I think users intuitively expect commands to be run in > terminal.Historically, the idea was that users expect ssh(1) to behave like rsh(1), which did not allocate a tty. -- Christian "naddy" Weisgerber naddy at mips.inka.de
On 04/15/2015 00:49, Christian Kandeler wrote:> > -o RequestTTY=yesThanks, this works. However, with this option ssh alters the output of all commands: it adds CR=0x0d in front of every NL=0x0a. This doesn't happen without this option. Why is sshd adding CR? I think the only effect of running in the terminal is the term flag that the process sees on the stdin and stdout (in shell it is [ -t 1 ]). The process is supposed to detect the terminal caps and print the output accordingly. I even verified that this is sshd is doing it and not the cat command by writing the C program printing newlines. Yuri