command-line

Run Xcode tools from the Terminal window

This is something really simple, but I can't seem to find the answer anywhere, and I'm new to both Mac and UNIX, which doesn't help. I've installed Xcode on my mac, along with the iPhone SDK 3.2. I'm trying to run Xcode command utilities that came with the SDK from the unix terminal, but I don't know how to update the paths so that the...

How do you get the playtime of an iTunes track with applescript?

I'm just starting to play around with Geektool and applescripting to make my mac desktop fun and I've run into a question I can't seem to find an answer to. How do you get the current song playtime from an osascript command? I've found great resources on how to do just about anything else with iTunes and osascript on the command line b...

Linux: How do I delegate exotic commandline arguments using a script?

Hello! I want to write a wrapper bash script, and to pass all arguments to a called program. I was very sure, that this works correctly: #!/bin/sh someProgam $@ But when passing exotic arguments (empty, unescaped, in quotes, ...) this fails. For example: without the wrapper script, someProgram "1 2" 3 results in the arguments [1 2] ...

Python - specify which function in file to use on command line

Hi guys, Assume you have a programme with multiple functions defined. Each function is called in a separate for loop. Is it possible to specify which function should be called via the command line? Example: python prog.py -x <<<filname>>> Where -x tells python to go to a particular for loop and then execute the function called in th...

How to change to an external disk drive in C

Hi all I was wondering how (if possible) to change to an external HDD in C. I am writing a program that works with an external HDD. Thanks much, Mr. Man ...

How to reenter Vim after :! bash?

I'm slowing getting to know Vim and Bash shell scripting and am running into this issue: When I'm running MacVim, I sometimes want to use the command line to compile whatever it is I'm working on (in this case a small Java program). So I type :! bash and compile whatever it is that I need and test it. Then when I want to go back to the ...

Cant run my programme from command line

I have a main method that creates an instance of a logic class public static void main(String[] args) { try { Logic logic = new Logic(args[0]); ....... do some stuff here } catch (Exception e) { System.out.println("Error Encountered Details: " + e); } } the thing is th...

Read (unnamed) argument in console line

As ConsoleFx seems to be progressing too slow (bummer, it had much potential) and showing too many breaking changes every build, I decided to switch to Mono.Options for my commandline parsing needs. My OptionSet is built in the following method private static OptionSet BuildOptionSet() { OptionSet optionSet = new OptionSet() ...

Run php from command line in 32-bit mode

Is it possible to tell php to run a script from the command line in 32-bit mode? I have a php script that uses an ODBC driver that is only works when PHP is run in 32-bit. Here is how I'm calling the script: php -d safe_mode=0 -f checkImport.php Any ideas? ...

what's an easy way to use hyphen named inputs in a console app (i.e. -S "myServerName")?

I'd like my console app to use hyphen-named inputs, like so: myApp -S "myServerName" -D "myDatabaseName" instead of the usual: myApp "myServerName" "myDatabaseName" I think the first is more friendly to developers that want to use my console app down the road. I think that I don't know what this type of input is called, else I wo...

How can I make svn command line client to forget the login credentials on windows (sliksvn)?

After having checked out once the repository to a folder, the svn command line client remembers the username and password (along with the repository url?). So, 2 questions arise: is there a way to make it stop remembering the login info (and ask user/pass every time)? is there a way to make it 'forget' the current login info (to delete...

Getting output on the same line of a file in DOS?

If I have output from two sources that I want to put together on the same line, how would I do that? In my case I have a file and a program. The file is something like this: listOfThings= My program outputs a list of strings on a single line. I want have a small script that runs nightly to put these two things together on a single li...

Finding the preferred application for a given file extension via unix shell commands

Hi, this may not be strictly about programming, but if I find no ready-made solution it may become a programming task: On UNIX, what is a command-line method for determining the user-preferred application for a given filetype? My ideal solution here would be a command that stopped me having to do the following: okular foo.pdf And al...

mirror single page with httrack

I am trying to use httrack (http://www.httrack.com/) in order to download a single page, not the entire site. So, for example, when using httrack in order to download www.google.com it should only download the html found under www.google.com along with all stylesheets, images and javascript and not follow any links to images.google.com, ...

Best workflow with Git & Github

Hey guys, im looking for some advice on how to properly structure the workflow for my team with git & github. we are recent svn converts and its kind of confusing on how we should best setup our day-to-day workflow. Here is a little background, im comfortable with command line and my team is pretty new to it but can follow use commands. ...

Cannot get PHP cron script to run

I have a PHP script that I need to run every minute. I have made sure that the script works from the command line, and I'm using absolute paths to avoid any environment issues: /usr/bin/php -q /var/www/myapp/services/myservice.php Manually running that as root from the command line works fine, as I can see from the log file that my sc...

Can you show me a quick working snippet to solve this command line option case?

I'd like to be able to support something like this when running my script from the command line: script.rb -n 2 -t first.txt -t second.txt I'd like to be able to take 1 or more t switches, but I have no clue how to achieve this. I would like to not have to do this: script.rb -n 2 -tfirst.txt,second.txt Got any ideas? ...

Executing untokenized command line from Java

I am currently using ProcessBuilder to run commands from a java server. This server is to replace an old Perl server, and a lot of our legacy code specifies platform specific command lines. For instance, on windows it might do: command -option "hello world" and on unix it might do: command -option 'hello world' The problem is t...

custom prompt in python

I have a script which when first run creates a new thread which logs certain events. After the thread has been created, I ask for some input on user with the following code: user_input = raw_input('>> ') So when the script it run the user receives the '>>' prompt, but when the logger from the created thread starts logging it starts to...

How can I kill child process using taskkill in a batch script?

I'm capturing the PID in a variable which I kill later IF NOT "%SERVICE_PID%" == 0 taskkill /pid %SERVICE_PID% /t /f though everytime I do this in a batch file it makes my computer restart because it kills some system process the service pid should be a user defined service launched from cmd I dont understand why it keeps making ...