terminal

Writing a “real” interactive terminal program like vim, htop, … in C/C++ without ncurses

ⅰ亾dé卋堺 提交于 2019-12-18 10:05:16
问题 No, I don't want to use ncurses , because I want to learn how the terminal works and have fun programming it on my own. :) It doesn't have to be portable, it has to work on linux xterm-based terminal emulators only. What I want to do is programming an interactive terminal application like htop and vim are. What I mean is not the output of characters which look like boxes or setting colors, this is trivial; also to make the content fit to the window size. What I need is how to get mouse

Run script on mac prompt “Permission denied”

爷,独闯天下 提交于 2019-12-18 10:03:34
问题 I'm new to mac with not familiar on terminal command, i put the dvtcolorconvert.rb file on root directory of my volume, this ruby script can converting xcode 3 themes into xcode 4 themes format, which is xxxxxxxx.dvtcolortheme format. Then run the script /dvtcolorconvert.rb ~/Themes/ObsidianCode.xccolortheme on terminal, but it's always prompt " Permission denied ". what's wrong with this? Anybody can help me solve this problem? Thanks. 回答1: Please read the whole answer before attempting to

nano error: Error opening terminal: xterm-256color

天大地大妈咪最大 提交于 2019-12-18 09:56:43
问题 After the installation of OSX Lion, I tried to: nano /etc/apt/sources.list But I get this error: Error opening terminal: xterm-256color If I try to switch terminal.app preferences to open terminal windows in "xterm color" instead of xterm-256color everything works fine. What's happening? 回答1: On Red Hat this worked for me: export TERM=xterm further info here: http://www.cloudfarm.it/fix-error-opening-terminal-xterm-256color-unknown-terminal-type/ 回答2: After upgrading to OSX Lion, I started

Remove blank lines with grep

北慕城南 提交于 2019-12-18 09:55:25
问题 I tried grep -v '^$' in Linux and that didn't work. This file came from a Windows file system. 回答1: Try the following: grep -v -e '^$' foo.txt The -e option allows regex patterns for matching. The single quotes around ^$ makes it work for Cshell. Other shells will be happy with either single or double quotes. UPDATE: This works for me for a file with blank lines or "all white space" (such as windows lines with "\r\n" style line endings), whereas the above only removes files with blank lines

Why does program not execute final printf statement?

放肆的年华 提交于 2019-12-18 09:46:22
问题 I cannot figure out why program control does not reach the third printf, right after the for loop. Why won't the third printf print? If I change the for loop to while loop, it still will not print. Here is the program and output: main() { double nc; printf ("Why does this work, nc = %f\n", nc); for (nc = 0; getchar() != EOF; ++nc) { printf ("%.0f\n", nc); } printf ("Why does this work, nc = %f", nc); } The output is: Why does this work, nc = 0.000000 test 0 1 2 3 4 回答1: It works fine for me,

Undefined symbols for architecture i386:

我的梦境 提交于 2019-12-18 08:26:20
问题 I've recently moved over to a mac, and am struggling using the command line compilers. I'm using g++ to compile, and this builds a single source file fine. if I try to add a custom header file, when I try to compile using g++ I get undefined symbols for architecture i386. The programs compile fine in xCode however. Am I missing something obvious? tried using g++ -m32 main.cpp... didn't know what else to try. Okay, The old code compiled... Have narrowed it down to my constructors. class Matrix

Swift.org issue with open source swift project. Error: xcrun: error: unable to find utility “launch-with-toolchain”, not a developer tool or in PATH

岁酱吖の 提交于 2019-12-18 07:33:11
问题 I am trying to Start Xcode with the custom toolchain and to be enabled to use the open source version of Swift. Steps are taken from Swift.org And I receive this error: xcrun: error: unable to find utility "launch-with-toolchain", not a developer tool or in PATH 回答1: The open source Swift toolchain from https://swift.org/download/#apple-platforms requires the latest Xcode 7.2 (currently: beta 4). The location of the developer directory used by xcrun and other build tools must be set to this

Rscript: command not found

狂风中的少年 提交于 2019-12-18 06:59:34
问题 I'm working with R for a while, and I always worked with Rstudio, I tried just now to run a Rscript command in terminal (I have a mac..) and I got this error- >Rscript script.R -bash: Rscript: command not found when I tried to open R in the terminal I go the same error- >R -bash: R: command not found I can run R code with the Rstudio and the R application, but I know there is a way to run R throw the terminal. Did I miss something when I installed R on my computer? do I need to add R to my

Hide cursor on remote terminal

。_饼干妹妹 提交于 2019-12-18 04:52:49
问题 I have an open socket to a remote terminal. Using the answer to "Force telnet client into character mode" I was able to put that terminal into character mode. My question is, how do I hide the cursor in the remote terminal using this method? 回答1: This is something that the ncurses library can do for you. The curs_set() function can make the cursor invisible. 回答2: To expand upon mjh2007's answer, the following c/c++ code will implement sending the escape codes to the terminal, and is slightly

Making the PATH and other environment variables available in emacs

試著忘記壹切 提交于 2019-12-18 04:47:14
问题 Working with emacs in OSX can some times be troubling. I interchange with using the Terminal.app application and the emace shell both of these use bash, and both seem to work, I do however have the problem that the environment is not setup identically in both. I'm running a clean installation of OSX Lion, and emacs 24 from emacs and would like for the environment variables in the emacs shell to make the same as in the Terminal.app under osx. How do I fix that? 回答1: Just install the awesome