terminal

Open Terminal window and pre-populate with command

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 05:46:29
问题 Is it possible to use the open command to open a Terminal window and pass it an argument to pre-populate the new window with a specific command? 回答1: Like this, but using osascript rather than open : osascript -e 'tell app "Terminal" to do script "ls -l"' If you want to use a bash variable in the script, do something like this: BASHVAR="hello" osascript<<EOF tell app "Terminal" to do script "echo $BASHVAR" EOF 来源: https://stackoverflow.com/questions/32441603/open-terminal-window-and-pre

IntelliJ: Launch Run-configuration from the embeded terminal

隐身守侯 提交于 2019-12-25 05:28:15
问题 Lets say I have run-config1 and run-config2 setup for my project in IntelliJ. I know there are ways of adding custom shell code to be perfomed before/after a build run, but that's not what I want to do. Is there a way of calling them from the embedded terminal? 回答1: As of IntelliJ IDEA 14 there is no such way. You can write a plugin for IntelliJ IDEA that will handle a command like "idea.sh run configuration-name" and start the run configuration in the existing instance, but this is fairly

Compile Latex code using Swift

送分小仙女□ 提交于 2019-12-25 05:25:49
问题 I wanted to compile a .tex file using Swift. I have the following code: class FileManager { class func compileLatex(#file: String) { let task = NSTask() task.launchPath = "/usr/texbin/latexmk" task.currentDirectoryPath = (NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! String).stringByAppendingString("/roster") task.arguments = ["-xelatex", file] task.launch() } } However, when calling FileManager.compileLatex(file: "latex.tex") I get the error 'launch

How to display a file with multiple lines as a single string with escape chars (\n)

拈花ヽ惹草 提交于 2019-12-25 04:15:54
问题 In bash, how I can display the content of a file with multiple lines as a single string where new lines appears as \n . Example: $ echo "line 1 line 2" >> file.txt I need to get the content as this "line 1\nline2" with bash commands. I tried using a combinations of cat/printf/echo with no success. 回答1: You can use bash's printf to get something close: $ printf "%q" "$(< file.txt)" $'line1\nline2' and in bash 4.4 there is a new parameter expansion operator to produce the same: $ foo=$(<file

create-react-app not currently working

北城以北 提交于 2019-12-25 04:13:49
问题 I've ran npm install create-react-app -g and then create-react-app hello-world returns -bash: create-react-app: command not found I understand that my $PATH is currently messed up. Here's what is returned from echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin I really don't know what to set this as, as I'm currently very new to the terminal. Any help would be greatly appreciated. Thank you! 回答1: Just export path to .bashrc and then call it from .profile file all in $Home directory then

create-react-app not currently working

↘锁芯ラ 提交于 2019-12-25 04:13:03
问题 I've ran npm install create-react-app -g and then create-react-app hello-world returns -bash: create-react-app: command not found I understand that my $PATH is currently messed up. Here's what is returned from echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin I really don't know what to set this as, as I'm currently very new to the terminal. Any help would be greatly appreciated. Thank you! 回答1: Just export path to .bashrc and then call it from .profile file all in $Home directory then

clear terminal (and history!) in Python

末鹿安然 提交于 2019-12-25 04:12:43
问题 This is almost a duplicate of clear terminal in python, but not quite. That question reads: Does any standard "comes with batteries" method exist to clear the terminal screen from a python script, or do I have to go curses (the libraries, not the words) ? All of the responses there result in what happens when you enter clear on your terminal - everything on your screen disappears except for an empty command line at the very top. But, if you'd like, you can scroll back up to see what you were

Python Multiple Line Terminal Update

≡放荡痞女 提交于 2019-12-25 03:19:17
问题 Short Question Is it possible/practical to write and update a multi-line (contains \n ) string on a Windows terminal? Background I have looked into curses, but it is Unix only. I saw a few other Window ports, but it was a bit troubling that Windows XP was an experimental OS for one them. I am hoping to use this as part of a diagnostic feature to display link status, message rates, etc on a mainly terminal application (note that some variants do have a wxPython GUI input). That being said,

How to find the location of a bash file?

血红的双手。 提交于 2019-12-25 02:45:17
问题 I've made an executable jar file for a terminal game I've been working on. So far, I opened it by typing java -jar name.jar in the Terminal. This worked, but when I made a .sh file with the same command, the jar file couldn't be accessed. (situation [1]) Later, I realised that if I specify where the jar file is, it does open. (situation [2]) But the jar file and bash file are in the same folder called "playgame", and if I were to move that folder elsewhere, that file path specified in the

C-<SPC> is intercepted in emacs -nw (terminal intercept?)

╄→гoц情女王★ 提交于 2019-12-25 02:43:42
问题 I use urxvt (terminal) under awesome (window manager) and ubuntu (os). In graphical mode, c- set the mark but in text mode it inserts a space. The problem is solved when using gnome-terminal but some other key combinations still does not work. For instance, C-: insert a : in both terminals. I do not know where to look at to correct this behaviour. C-h k (help on key combination) followed by one of these combination shows only the key pressed along ctrl, for instance C- is interpreted as . As