terminal

Discovering remote Terminal for Terminal Escape Codes? (DECDHL in this case)

本小妞迷上赌 提交于 2020-01-06 16:20:58
问题 I am trying to determine WHAT console I am running in. (Exceptionally hard based on the research I have done so far.) The latest feature that I discovered that would be useful is Double High, Double Wide for a couple of scenarios. The setup is a Kubuntu 15.04 machine with native (lower) and remote access via Terminal.app on OS X 10.10.4. Based on vt100.net Apple is doing the right thing. #!/bin/bash # Cool effect with OS X Terminal.app # Not as much on others (Like Konsole) function embiggen(

Transparent interaction with console (sh,bash,cmd,powershell)

一个人想着一个人 提交于 2020-01-06 15:50:44
问题 Please help me to write simple console application in python. It should redirect all input to system shell (bash or windows cmd or powershell) and give all their output to the screen. Simply I can say run terminal from python application. The next code works with some strange behavior: first 3 times after any key pressed it outputs (executes?) some previous commands (may be from cache) #!/bin/python3 import subprocess import sys proc = subprocess.Popen(['bash']) while True: buff = sys.stdin

Running newer version of R from terminal when older version is invoked by default

孤街醉人 提交于 2020-01-06 15:08:53
问题 I'm trying to run R from iTerm on an OSX computer (OSX 10.11.6). When I enter R , it opens up an older version of R, from the path /Users/***/miniconda2/bin/R . I would like it to run, by default, an R version found at /usr/local/bin/R , without having to enter the full path every time. How would one go about changing the location of the default R? Thanks for your help 回答1: This is likely due to the PATH variable preferring ~/miniconda2/bin before /usr/local/bin . I'm giving you a few options

Expect Script to Send Different String Outputs

只愿长相守 提交于 2020-01-06 14:51:09
问题 I have something like this. expect "hi" { send "You said hi\n" } "hello" { send "Hello yourself\n" } "hi" { send "2nd time you said hi\n" } The scenario is I will get a initial response 'hi', then 'hello', then 'hi' again. The second time I get a response of 'hi', I want to send a different string. Thanks. 回答1: You should use a list and iterate... set responses {{You said hi} {2nd time you said hi}} set idx 0 while {$idx < [llength $responses]} { expect { "hi" { send [lindex $responses $idx]

script runs fine in terminal but not from launchd

China☆狼群 提交于 2020-01-06 09:55:48
问题 My Python script runs fine in the terminal but when I try to set it up to run once a day at a certain time with launchd (set up using software called Lingon), I just can't get it to run. From everything I've read, it's better to invoke the Python script from a shell script (I'm on a Macbook, running Yosemite). So, that's what I'm trying to do. The errors I get when the script is due to be run are: TERM environment variable not set. env: python3: No such file or directory At this point, I'm

cannot write to pty - linux

◇◆丶佛笑我妖孽 提交于 2020-01-06 08:46:14
问题 i am the owner of the pty device created like this permissions are crw-w---- mknod pty1 c 1 1 cat > pty1 tells me operation not permitted. what i want to do later is that i open the file from a program using open and call write to send output to the terminal, as if it is a disk file. why is cat not working. can we write to a pty or read from a pty using open and write. can we do this from java. java writes to a file that is actually a pty. source of problem: forcing a program to flush its

How to point configure down the right path to icu

风流意气都作罢 提交于 2020-01-06 08:19:08
问题 I'm a newcomer to macs and terminal in particular, so this may be a stupid question. I'm trying to run ./configure in mysrc/myfreeling so that I can install freeling but I get this error: checking for main in -licuuc... no Unicode ICU library not found. Make sure libicu is installed and can be found in a standard path. You may need to set LDFLAGS to specify search path. Now, when I do "port installed" it shows: icu @49.1.2_0 (active) So I know that I have icu. So I tried env LDFLAGS="-L/opt

Create php file with content from terminal

こ雲淡風輕ζ 提交于 2020-01-06 06:40:19
问题 I was wondering how, for example, cakePHP can use the terminal/command line to create files and put content in it. I guess they use some kind of template for the content but how do they do it? I know that you can create controllers and so on with it. Anyone know how it's done? / Tobias EDIT: I've been searching and searching but can't find anything about this. Please is there anyone who can help me with this? 回答1: You can use templates for easy to create files or something like Zend

Command Line Arguments not getting executed in C

六眼飞鱼酱① 提交于 2020-01-06 06:33:06
问题 I am trying to pass arguments to execl() function for ls command. But when I pass /bin/ls -l -a as arguments to my program, the execl() function doesn't recognise the last two arguments. Why is that?Here is the code: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i,childpid; if(argc!=4) { printf("you didn't provide any commandline arguments!\n"); return 0; } childpid=fork(); if(childpid<0) { printf("fork() failed\n"); return 0; } else if(childpid==0) { printf(

Bash “while read loop” does not properly recognize variables [duplicate]

若如初见. 提交于 2020-01-06 06:19:15
问题 This question already has answers here : bash variable interpolation separate variables by a hyphen or underscore (3 answers) Error in string Concatenation in Shell Scripting (3 answers) Closed 2 years ago . I am using MacBook pro terminal to execute a shell script. It loops through a text file and create filenames based on each line in the file. #!/bin/bash year=2010 list=list_test.txt mydir=thisdir i=1 # counter while read line do echo $i $line file1=`echo $mydir/file_$year_$line_test.tif`