terminal

(unix/C) “stty: stdin isn't a terminal” when using system() function

穿精又带淫゛_ 提交于 2019-12-23 03:37:10
问题 We're reading a file from stdin into file_buffer , and then stepping into a method more . As soon as we use system("stty cbreak -echo"); , the output prints "stty: stdin isn't a terminal" and doesn't set our terminal to the settings we asked for. This problem only exists when we use standard in. If we use a file argument, the program works fine -- the terminal settings get set, and there is no error message. So, this is okay: myprogram file1.txt But this is not: myprogram < file1.txt Either

Removing first 3 characters of file names in linux

萝らか妹 提交于 2019-12-23 03:34:21
问题 I need a sh script to do remove the first 3 characters of file names, for example: "AB file 1.pdf" "BC file 2.pdf" "DB file 3.pdf" "AD file 4.pdf" ... to: "file 1.pdf" "file 2.pdf" "file 3.pdf" "file 4.pdf" ... I think the script will be like: #!/bin/sh for i in *.pdf; do newName= ???? mv $i $newName done 回答1: Use the cut command: newName=$(echo "$i" | cut -c4-) In bash you can use a Parameter Expansion extension: newName=${i:3} Also, don't forget to quote your variables: mv "$i" "$newName"

emacs keybinding doesn't work in terminal

雨燕双飞 提交于 2019-12-23 02:55:19
问题 I've set the following key bindings in my .emacs file: (global-set-key (kbd "C-S-M-w") 'windmove-up) (global-set-key (kbd "C-S-M-s") 'windmove-down) (global-set-key (kbd "C-S-M-d") 'windmove-right) (global-set-key (kbd "C-S-M-a") 'windmove-left) (global-set-key (kbd "C-S-a") 'shrink-window-horizontally) (global-set-key (kbd "C-S-d") 'enlarge-window-horizontally) (global-set-key (kbd "C-S-s") 'shrink-window) (global-set-key (kbd "C-S-w") 'enlarge-window) They work just fine when they're in

How to continuously write output from Python Program running on a remote host (Raspberry Pi) executed with C# SSH.NET on local console?

自作多情 提交于 2019-12-23 02:50:05
问题 I'm writing a program in C# on my computer which should start a Python program on a remote Raspberry Pi. For the moment the Python code is just printing 'Hello' every second. The program should run permanently. When I start this program from C#, I would like to have a visual feedback, if my program is running – I'd like to see the printed output like in PuTTY. The following code works fine for a command like ls . But for the reason that my Python program test.py should not finish – I never

How do I reset/clear erlang terminal

喜夏-厌秋 提交于 2019-12-23 02:33:05
问题 I'm trying to get the prompt reset, forget all the variables and start the prompt from line 1> I'm aware of the following built-in functions f(). %% forget all io:format("\e[H\e[J"). %% "clear screen" and moving cursor to the begin of the line but when I'm writing the following commands, it does forget all the variables, but it doesn't "reset" the screen, just clear the screen, like clear command in the terminal. in Linux, I just type reset , but I couldn't find equivalent command or built in

How to change Terminal background color when I open new tab?

三世轮回 提交于 2019-12-23 01:54:46
问题 I wanted to change color when I login to remote server by ssh. The problem solved by this question. How do I make the apple terminal window auto change colour scheme when I ssh to a specific server But the solution above have a little problem. Connet to remote server by ssh. (Background color is changed) Open new terminal Tab. This Tab's background is still changed. So I want to "reset" background color when I open new Terminal Tab. How can I do it? 回答1: By default, Terminal creates new tabs

For the pycharm IDE how would I open a terminal in the IDE that uses an identical project environment

我们两清 提交于 2019-12-22 17:25:06
问题 Currently when I open a terminal in or out of pycharm the path has it open up python2.7.8. My project interpreter in python points to another version installed on my system (python2.6) it all works fine except when I open a terminal from within pycharm it still points to python2.7.8. I know about .pycharmrc, but how would I have the pycharm terminal point to the project python interpreter? Is there an an easy way? 来源: https://stackoverflow.com/questions/24809181/for-the-pycharm-ide-how-would

Making terminal input send after a certain number of characters

你。 提交于 2019-12-22 16:35:08
问题 I am creating a Linux terminal program using C. I am trying to make a two digit code address a array location. I don't want to have to hit enter after every two digit input, I want the input to just be sent to my buffer variable through scanf directly after to characters are entered. I do not have a code sample, as i have no idea how to approach this. Thanks for any help! 回答1: You've got two options, which solve the same problem in nearly the same way. The first is to use stdbuf when you run

Making terminal input send after a certain number of characters

喜夏-厌秋 提交于 2019-12-22 16:34:03
问题 I am creating a Linux terminal program using C. I am trying to make a two digit code address a array location. I don't want to have to hit enter after every two digit input, I want the input to just be sent to my buffer variable through scanf directly after to characters are entered. I do not have a code sample, as i have no idea how to approach this. Thanks for any help! 回答1: You've got two options, which solve the same problem in nearly the same way. The first is to use stdbuf when you run

Building a Terminal Emulator for Android

有些话、适合烂在心里 提交于 2019-12-22 13:54:06
问题 I've been trying to build a Terminal Emulator for Android. Being pretty new to this, my idea was to execute each command and store the output in a file, whose contents would be displayed after each execution. Pseudo Code : public Boolean execCommands(String command) { try { rt = Runtime.getRuntime(); process = rt.exec("su"); DataOutputStream os = new DataOutputStream(process.getOutputStream()); os.writeBytes("echo $ \""+command+ "\" >> /sdcard/Android/data/terminalemulatorlog.txt\n\n\n"); /**