terminal

Open jar file using JRE on Mac

半腔热情 提交于 2019-12-10 15:14:48
问题 I have a jar file that is meant to be ran through the command line. I am not planning to do any java development on the machines where the application will run and my thought process is that therefore I should only need the JRE and not the JDK. In addition, the JDK is like 4x as big as the JRE and I would like to not have to download it. When installing the JRE on a Mac, it does not set the path for the java command and if I try to run it, osx prompts me to install the JDK. I wonder if anyone

Terminfo smkx and Application Cursor Keys vs Application keypad

妖精的绣舞 提交于 2019-12-10 15:09:34
问题 XTerm Control Sequences specifies the following key sequences: CSI ? 1 h → Application Cursor Keys (DECCKM) CSI ? 1 l → Normal Cursor Mode (DECOM) CSI ? 66 h → Application keypad (DECNKM) CSI ? 66 l → Numeric keypad (DECNKM) and the Terminfo Source Format has the following entry: Variable: keypad_xmit Capname: smkx Termcap: ks Description: Put terminal in "keypad-transmit" mode But the terminfo for xterm actually says smkx=\E[?1h\E= , which seems mixed up to me (smkx should affect the keypad,

How to capture the title of a terminal window in bash using ANSI escape sequences?

折月煮酒 提交于 2019-12-10 15:08:36
问题 I am using the bash command line in OSX. I know that the ANSI escape sequence \033[21t will retrieve the title of the current terminal window. So, for example: $ echo -ne "\033[21t" ...sandbox... $ # Where "sandbox" is the title of the current terminal window $ # and the ... are some extra control characters What I'd like to do is capture this information programmatically in a script, but I can't figure out how to do it. What the script captures just the raw ANSI escape sequence. So, for

Making the “ls” command sort “a” before “B” (vs a->b->A->B)

…衆ロ難τιáo~ 提交于 2019-12-10 15:07:32
问题 I am trying to find a way to have the results of an ls command be printed in a case insensitive manner. currently an ls command results in: Apple Boy Chart Dock apples boys charts docks what i want is this: Apple apples Boy boys Chart charts Dock docks is this possible? 回答1: ls (at least if you're using the GNU coreutils version; ls --version to check that) sorts file names according to the current locale. The set of available locales varies from system to system ( locale -a for a list), but

PHP in command line

人走茶凉 提交于 2019-12-10 14:58:33
问题 Using Python I can test my code in the terminal / command line by typing python python> print "hello world" I would like to do this with PHP too, but when typing: php echo "hello world"; it does not work.. Is this possible? what should I do? A quick search on the internet gives a lot of results that call an actual .php file to run. I only want to test a single sentence if possible, without creating files and stuff. 回答1: Try php -a which starts an interactive PHP shell. Be aware that this

Which tool for colorizing output of javac?

断了今生、忘了曾经 提交于 2019-12-10 14:40:04
问题 We have a hugely parallelized build process, so I frequently have to browse through large amounts of output from javac to find a build error. To make this easier it would be nice if there were some tool that will colorize the output of javac to my terminal, highlighting errors in the code. What tool can I use to colorize the output of javac? 回答1: I ended up using a tool called Generic Colorizer Tool and write my own configuration for colorizing the most important output. Works just fine. :)

cd Terminal at a given directory after running a Python script?

风流意气都作罢 提交于 2019-12-10 14:34:23
问题 I'm working on a simple Python script that can use subprocess and/or os to execute some commands, which is working fine. However, when the script exits I'd like to cd the actual Terminal (in this case OS X) so on exit, the new files are ready to use in the directory where the have been created. All the following ( subprocess.Popen , os.system , os.chdir ) can do what I want from within the script (i.e. they execute stuff in the target directory) but on exit leave the Terminal at the script's

Error when trying to self-update composer

情到浓时终转凉″ 提交于 2019-12-10 14:11:20
问题 when I trying to self-update composer I get "Permission denied" error message, but when I try to do same command with "sudo" - I get error message "command not found". Please help me.. 回答1: In terminal with sudo I type full path to composer.phar and it's work for me! sudo /usr/bin/composer.phar self-update 回答2: For me this worked: sudo -H composer self-update 来源: https://stackoverflow.com/questions/28679994/error-when-trying-to-self-update-composer

Terminal scripting in OSX

爱⌒轻易说出口 提交于 2019-12-10 14:00:52
问题 I've never created a script before and am looking for a tutorial on writing a script for OSX 10.6. There is a terminal command that can show all hidden files. It's defaults write com.apple.finder AppleShowAllFiles TRUE killall Finder Changing TRUE to FALSE will hide system files. I want to make a script that checks the value of AppleShowAllFiles, and if TRUE, writes FALSE, and if FALSE, writes TRUE. Is this done in TextEdit and saved as a .sh file? Can a script be something I double-click

Use $RANDOM in a makefile

别说谁变了你拦得住时间么 提交于 2019-12-10 13:46:21
问题 I am making a makefile to rename files with a random number in it (I am a newbie in shell script). I don't understand why, but when I run the file $rand is given the value 'ANDOM'. When I run this outside of the makefile it works. I run this in the Mac os terminal, in case it's helpful. all: renamefiles renamefiles: rand=$RANDOM && mv myfile.css $rand-myfile.css && mv myotherfile.css $rand-myotherfile.css 回答1: Wouldn't it be easier/better to use a date/time stamp so that the renamed files are