terminal

How to open an app in terminal and passing the current working directory?

旧街凉风 提交于 2019-12-08 14:44:27
问题 I often want to open the entire directory I'm working in by using the mate command, but how do I pass in the working directory itself? For example, if I'm working in a rails app and I want to open the app folder into the TextMate tree, I would do mate app , but how could I pass in the working directory itself (i.e. open the entire rails app in the tree)? 回答1: mate . will open the currently directory. I use the . directory a lot, for example open finder for the current directory open . . 回答2:

Merge two json in bash (no jq)

一个人想着一个人 提交于 2019-12-08 14:20:35
问题 I have two jsons : env.json { "environment":"INT" } roles.json { "run_list":[ "recipe[splunk-dj]", "recipe[tideway]", "recipe[AlertsSearch::newrelic]", "recipe[AlertsSearch]" ] } expected output should be some thing like this : { "environment":"INT", "run_list":[ "recipe[splunk-dj]", "recipe[tideway]", "recipe[AlertsSearch::newrelic]", "recipe[AlertsSearch]" ] } I need to merge these two json (and other like these two) into one single json using only available inbuilt bash commands. only have

problem with ImageMagick And Java Runtime Exec

别来无恙 提交于 2019-12-08 13:44:47
问题 I Have a bit of a strange problem no java expert i know could solve .. i need to used imagemagick on my application to make the emails on my website converted to images so no pot can take the emails easily .. the problem solved with image magick command line as following convert -size 200x30 xc:transparent -font /home/emad/TITUSCBZ.TTF -fill black -pointsize 12 -draw "text 5,15 'emadhegab@hotmail.com'" /home/emad/test.png and it work like magic really and so i tried to put that on the java to

After restarting Terminal, I can no longer execute Node

蹲街弑〆低调 提交于 2019-12-08 13:31:03
问题 For some reason, after I restart Terminal, I won't be able to execute node anymore . Trying so results in the following error: -bash: node: command not found I tried removing node and reinstalling it. That works, but as soon as I restart Terminal, the magic is lost. How can this be? 回答1: could the magic involve setting the PATH variable so node would be on the path if so then add the magic to your .bashrc ? 来源: https://stackoverflow.com/questions/6786378/after-restarting-terminal-i-can-no

Trying to run simple Bash command in Swift - 'Couldn't posix_spawn: error 13'

◇◆丶佛笑我妖孽 提交于 2019-12-08 13:07:24
问题 I'm trying to build a MacOS app that can run bash commands from GUI input and have fallen at the first hurdle. I've been using this question's answer as a reference but it doesn't seem to work for me. This is my code: import Foundation @IBAction func buttonClicked(_ sender: Any) { shell("ls") } @discardableResult func shell(_ args: String...) -> Int32 { let task = Process() task.launchPath = "/Users/myUser/desktop" task.arguments = args task.launch() task.waitUntilExit() return task

Call a command in terminal using Java (OSX)

假如想象 提交于 2019-12-08 12:45:48
问题 I am trying to write Java code to run wget to retrieve an image from a server I believe that I have wget properly installed. If I type: wget http://insitu.fruitfly.org/insitu_image_storage/img_dir_38/insitu38795.jpe I find the image in my user account folder. The following Java code was working properly on Ubuntu, but I had to move the project over to OSX (Mountain Lion) import java.io.*; import java.io.IOException; public class runWget { public static void main (String args[]) { String

Handling Java command line arguments in the format “cat file.txt | java YourMainClass”

醉酒当歌 提交于 2019-12-08 11:30:00
问题 I've never used java from the terminal before, and I certainly have never coded for it. My question is simple: How do I intake a file when the calling format is cat file.txt | java YourMainClass I have the rest of the code up and running swimmingly, I just need to take the given file name into my main method. 回答1: Since the cat command displays the contents of the file, you need to use the System.in buffer to capture the data coming in from that command. You can use a BufferedReader pointing

How to delete text after getstr() c++ ncurses

笑着哭i 提交于 2019-12-08 10:50:30
问题 I have been learning to use the ncurses library and I have come across getstr(). I was wondering how you would erase the text from getstr() on the terminal after the value has already been stored in a variable? I have tried to find the answer on google but no luck! Basically I want it so when the user presses enter the text will be removed from the screen. 回答1: As far as I know, ncurses has two functions, gotoxy() and getxy() , which let you jump to every position of the screen and tell you

How to use 'catdoc' to display dock file encoded in utf-8

扶醉桌前 提交于 2019-12-08 10:30:31
问题 I have a a lot of docx files and I want to read them on terminal. And I found catdoc http://www.wagner.pp.ru/~vitus/software/catdoc/ When I use it, the output are just unreadable chars. My docx files are encoded in utf-8. I tried "catdoc -u my_file.docx" but does not work. Please help. Thank you very much. 回答1: docx are zipped XML files. To extract and strip the XML try something based on unzip -p "*.docx" word/document.xml | sed -e 's/<[^>]\{1,\}>//g; s/[^[:print:]]\{1,\}//g' from command

Running java program from terminal

人走茶凉 提交于 2019-12-08 10:17:47
问题 I'm developing a java program to run on the raspberry pi and I can't get it to run using terminal. It consists of two classes both of which are located at: /home/pi/JBerries/Access control/bin/access/control Also note it is a GUI program made using swing. This is the command I'm using to try and run it currently: pi@raspberrypi ~/JBerries/Access control $ java -classpath .bin.access.control.accessControlUI And this is what it spits out: Usage: java [-options] class [args...] (to execute a