terminal

ANSI escape sequences aren't printed to stdout on Windows

怎甘沉沦 提交于 2019-12-31 03:02:58
问题 I'm trying to write an ANSI escape sequence to stdout using node.js on Windows, but it does not appear to work. Specifically, I use ConEmu which does support a subset ANSI codes. I've created a test file which should rename the current console tab: process.stdout.write('\x1b]9;3;"abc"\x1b\x5c'); However, nothing happens when I run it. If I run node test > out.txt , the correct bytes are written to the output file. Why don't the escape sequences work? 回答1: When node's stdout is connected to a

How to run ionic in the background

吃可爱长大的小学妹 提交于 2019-12-31 01:33:28
问题 I am trying to run ionic serve in the background so I can test it via my rails app on circle ci. I thought I could do it with: nohup bash -c "ionic serve --nolivereload --nobrowser &" But unfortunately it doesn't work. Does anyone know how to run it in the background? 回答1: You could use screen : screen -d -m -L ionic serve --nolivereload --nobrowser 回答2: Why do you want it to run in background on CI ? It should be ok to run the command directly before your test: ionic serve --nolivereload -

How to get the cursor position in a C program using termcap, without writing a character?

好久不见. 提交于 2019-12-30 23:59:12
问题 I would like to know how to get the cursor position (x, y) in my program, without writing anything on the screen neither tracking it all the time. I found out a way to get its position with this function (I don't check the return of read, write, etc here to write a smaller code on this subject but I do it in my program) : void get_cursor_position(int *col, int *rows) { int a = 0; int i = 0; char buf[4] write(1, "\033[6n", 4); // string asking for the cursor position read(1, buf, 4); while

How to read console/user input in PHP?

南楼画角 提交于 2019-12-30 18:45:38
问题 I use gets to get an user input in Ruby. # in 0015.rb input_num = gets.to_i p "Your input number is #{input_num}." And I use it in a terminal. ➜ rubytest: ruby 0015.rb 24 "Your input number is 24." Can I do like this in PHP with terminal? 回答1: I think you are looking for the readline function $number = readline("Enter a number: "); echo 'You picked the number: '.$number; http://www.php.net/manual/en/function.readline.php 回答2: If you don't have readline installed, -or- you're writing a library

Python - open new shell and run command

允我心安 提交于 2019-12-30 10:08:32
问题 At the moment I am running a bash command from within Python using the following method: os.system(cmd) However I need to run the command in a new shell/terminal. Does anyone know how to do this? Thanks, Dan 回答1: I am using the following method (this will also redirect stderr to stdout): import subprocess cmd_line = "echo Hello!" p = subprocess.Popen(cmd_line, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) out = p.communicate()[0] print out 回答2: os.system() is deprecated in

Type null character in terminal

我怕爱的太早我们不能终老 提交于 2019-12-30 05:59:09
问题 Is there a way to type the null character in the terminal? I would like to do something like: this is a sentence (null) test123 回答1: In Linux, any special character can be literally inserted on the terminal by pressing Ctrl + v followed by the actual symbol. null is usually ^@ where ^ stands for Ctrl and @ for whatever combination on your keyboard layout that produces @ . So on my keyboard I do: Ctrl + v followed by Ctrl + Shift + @ and I get a ^@ symbol with a distinguished background color.

How to check if a files exists in a specific directory in a bash script?

淺唱寂寞╮ 提交于 2019-12-30 04:59:05
问题 This is what I have been trying and it is unsuccessful. If I wanted to check if a file exists in the ~/.example directory FILE=$1 if [ -e $FILE ~/.example ]; then echo "File exists" else echo "File does not exist" fi 回答1: You can use $FILE to concatenate with the directory to make the full path as below. FILE="$1" if [ -e ~/.myexample/"$FILE" ]; then echo "File exists" else echo "File does not exist" fi 回答2: This should do: FILE=$1 if [[ -e ~/.example/$FILE && ! -L ~/example/$FILE ]]; then

How do I enable curl SSL on Mac OS X?

自作多情 提交于 2019-12-30 03:11:05
问题 I'm using Terminal on Mac OS X 10.11.2 and I can't process any https requests. I always get this error: curl: (1) Protocol "https" not supported or disabled in libcurl I tried this but I get a "wrong directory" error: ./configure --with-ssl=/usr/local/ssl Any advice would be helpful. EDIT: This is the error I get when trying to install with ssl: configure: error: OpenSSL libs and/or directories were not found where specified! SOLUTION: For Mac OS X 10.6 or later use this to enable SSL: .

Can't install Vagrant box Laravel Homestead

谁说我不能喝 提交于 2019-12-29 18:33:44
问题 I'm trying to install Laravel Homestead on Mac OS X following the official documentation instructions on here. I installed VirtualBox and Vagrant. Now I'm trying to add the Homestead box with the command vagrant box add laravel/homestead . After a while the download stops and I get an error. It doesn't let me restore the download so I have to delete the partial download file and start from zero. I've tried it many times. I think my Internet connection has something to do since it's kinda slow

How to remove (base) from terminal prompt after updating conda

安稳与你 提交于 2019-12-29 17:45:10
问题 After updating miniconda3, whenever I open a terminal it shows "(base)" in front of my username and host. In this answer post https://askubuntu.com/a/1113206/315699 it was suggested to use conda config --set changeps1 False To remove it. But that would remove the indication for any conda environment. I would like to remove it only for the base one, so that I can maintain it always active and have access to its python and installed packages without having to always see this (base) taking up