tty

How to toggle CR/LF in gnu screen?

最后都变了- 提交于 2019-11-30 06:43:06
问题 I'm using screen to read the text from a serial console. The problem is the output seems to only have newline \n but not carriage return \r, so the display looks like this... Line1 Line2 Line3 I wonder if there is any patch to fix this issue? 回答1: Try stty onlcr . The man page says it will translate newlines to carriage return / newline pairs on output, which seems to be what you need. 回答2: onlcr is for translating o utgoing n ew l ines to c arriage r eturns. stty -F /dev/ttyS0 inlcr will

Pretend to be a tty in bash for any command [duplicate]

帅比萌擦擦* 提交于 2019-11-30 06:17:23
This question already has an answer here: Trick an application into thinking its stdout is a terminal, not a pipe 8 answers Whenever I use grep , and I pipe it to an other program, the --color option is not respected. I know I could use --color=always , but It also comes up with some other commands that I would like to get the exact output of that command as the output I would get if I was in a tty. So my question is, is it possible to trick a command into thinking that the command is run inside a tty ? For example, running grep --color word file # Outputs some colors grep --color word file |

How to workaround “the input device is not a TTY” when using grunt-shell to invoke a script that calls docker run?

穿精又带淫゛_ 提交于 2019-11-29 10:50:38
问题 When issuing grunt shell:test , I'm getting warning "the input device is not a TTY" & don't want to have to use -f : $ grunt shell:test Running "shell:test" (shell) task the input device is not a TTY Warning: Command failed: /bin/sh -c ./run.sh npm test the input device is not a TTY Use --force to continue. Aborted due to warnings. Here's the Gruntfile.js command: shell: { test: { command: './run.sh npm test' } Here's run.sh : #!/bin/sh # should use the latest available image to validate, but

Pretend to be a tty in bash for any command [duplicate]

时间秒杀一切 提交于 2019-11-29 05:55:08
问题 This question already has an answer here: How to trick an application into thinking its stdout is a terminal, not a pipe 8 answers Whenever I use grep , and I pipe it to an other program, the --color option is not respected. I know I could use --color=always , but It also comes up with some other commands that I would like to get the exact output of that command as the output I would get if I was in a tty. So my question is, is it possible to trick a command into thinking that the command is

How do I detect if stdout is connected to a tty in Perl?

↘锁芯ラ 提交于 2019-11-29 05:49:59
I'm looking for the Perl equivalent to this Python code: from sys import stdout if stdout.isatty(): print "yes" else: print "no" Use the -t filetest operator . print -t STDOUT ? "Yes\n" : "No\n" Note that in Perl, STDOUT can be tied (essentially an overcomplicated overloaded object) so output to STDOUT may still reach a TTY even if its not directly attached to one. Use IO::interactive if you require STDOUT to actually be connected to the terminal, and not just being redirected to /dev/null/ or whatever. 来源: https://stackoverflow.com/questions/3517250/how-do-i-detect-if-stdout-is-connected-to-a

Vagrant is attempting to interface with the UI in a way that requires a TTY

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 03:07:00
Problem: vagrant up fails with the error below. I am running vagrant on Windows 7 and the base box is Ubuntu )( files.vagrantup.com/precise32.box ). how can it be fixed? vagrant.bat up Bringing machine 'default' up with 'virtualbox' provider... [default] Clearing any previously set forwarded ports... [default] Clearing any previously set network interfaces... [default] Available bridged network interfaces: 1) Intel(R) PRO/1000 EB Network Connection with I/O Acceleration 2) Intel(R) PRO/1000 PL Network Connection Vagrant is attempting to interface with the UI in a way that requires a TTY. Most

How to workaround “the input device is not a TTY” when using grunt-shell to invoke a script that calls docker run?

烂漫一生 提交于 2019-11-29 01:05:42
When issuing grunt shell:test , I'm getting warning "the input device is not a TTY" & don't want to have to use -f : $ grunt shell:test Running "shell:test" (shell) task the input device is not a TTY Warning: Command failed: /bin/sh -c ./run.sh npm test the input device is not a TTY Use --force to continue. Aborted due to warnings. Here's the Gruntfile.js command: shell: { test: { command: './run.sh npm test' } Here's run.sh : #!/bin/sh # should use the latest available image to validate, but not LATEST if [ -f .env ]; then RUN_ENV_FILE='--env-file .env' fi docker run $RUN_ENV_FILE -it --rm -

Using netcat/cat in a background shell script (How to avoid Stopped (tty input)? )

空扰寡人 提交于 2019-11-28 10:13:36
Abstract: How to run an interactive task in background? Details: I am trying to run this simple script under ash shell (Busybox) as a background task. myscript.sh& However the script stops immediately... [1]+ Stopped (tty input) myscript.sh The myscript.sh contents... (only the relvant part, other then that I trap SIGINT, SIGHUP etc) #!/bin/sh catpid=0 START_COPY() { cat /dev/charfile > /path/outfile & catpid = $! } STOP_COPY() { kill catpid } netcat SOME_IP PORT | while read EVENT do case $EVENT in start) START_COPY;; stop) STOP_COPY;; esac done From simple command line tests I found that bot

How can I implement timeout for read() when reading from a serial port (C/C++)

北城余情 提交于 2019-11-28 08:28:49
I am reading bytes from a serial port in C++ using a file descriptor and the posix/unix read() function. In this example, I am reading 1 byte from the serial port (baud rate settings and similiar are omitted for clarity): #include <termios.h> #include <fcntl.h> #include <unistd.h> int main(void) { int fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY); char buf[1]; int bytesRead = read(fd, buf, 1); close(fd); return 0; } If the device connected to /dev/ttyS0 does not send any information, the program will hang. How can I set a timeout? I have tried setting a time out like this: struct termios options;

Receiving key press and key release events in Linux terminal applications?

独自空忆成欢 提交于 2019-11-28 08:16:53
I would like to write a simple C program that will perform different actions based on both "key down" and "key up" events. This program will be run from inside rxvt . What library or mechanism should I use to access both key presses and releases? Is it true that reading /dev/tty will only provide key releases? Is this also true for termcap, terminfo, ncurses, and slang? Is there a way to achieve this from within a terminal application? The following links may be of some assistance in using the keyboard raw mode which will give you access to the keyboard events rather than just key releases.