cli

How do I rake tasks within a ruby script?

I've got a Rakefile with a rake task that I would normally call from the commandline (rake blog:post Title). I'd like to write a ruby script that calls that rake task multiple times, but the only solution I see is shelling out (`` or system). What's the right way to do this?...

Examining Berkeley DB files from the CLI

I have a set of Berkeley DB files on my Linux file system that I'd like to examine. What useful tools exist for getting a quick overview of the contents? I can write Perl scripts that use BDB modules for examining them, but I'm looking for some CLI utility to be able to take a look inside without having to start writing scripts. ...

In Ruby, is it possible to concat arguments to a command line using backquotes ?

I would like to execute an OS command from my ruby script but I want to add an argument from a ruby variable. I know that's possible by using keyword system like that : #!/usr/bin/env ruby directory = '/home/paulgreg/' system 'ls ' + directory but is that possible by using the "backquotes or backticks syntax" ? (I mean by using that ...

Is there a better Windows "Terminal" application?

I loath working on the command line in Windows, primarily because the terminal application is wretched to use compared to terminal applications on linux and OS X. Major complaints No standard copy/paste. You have to turn on "mark" mode and it's only available from a multi-level popup triggered by the (small) left hand corner button. ...

Flush disk write cache from Windows CLI

Does anyone know how to flush the disk write cache data from the cache manager for the current directory (or any given file or directory, for that matter), from a Windows command line? ...

Moving the child nodes of an XML node upwards

Imagine I have the folling XML file: <a>before<b>middle</b>after</a> I want to convert it into something like this: <a>beforemiddleafter</a> In other words I want to get all the child nodes of a certain node, and move them to the parent node in order. This is like doing this command: "mv ./directory/* .", but for xml nodes. I'd like...

Create cronjob with Zend Framework

I am trying to write a cronjob controller, so I can call one website and have all modules cronjob.php executed. Now my problem is how do I do that? Would curl be an option, so I also can count the errors and successes? [Update] I guess I have not explained it enough. What I want to do is have one file which I can call like from http...

Searching/reading another file from awk based on current file's contents, is it possible?

I'm processing a huge file with (GNU) awk, (other available tools are: Linux shell tools, some old (>5.0) version of Perl, but can't install modules). My problem: if some field1, field2, field3 contain X, Y, Z I must search for a file in another directory which contains field4, and field5 on one line, and insert some data from the found...

What is the canonical way to determine commandline vs. http execution of a PHP script?

I have a PHP script that needs to determine if it's been executed via the command-line or via HTTP, primarily for output-formatting purposes. What's the canonical way of doing this? I had thought it was to inspect SERVER['argc'], but it turns out this is populated, even when using the 'Apache 2.0 Handler' server API. ...

Does CLI mean anything other than "command line interface"?

According to Wikipedia, on the Comparison of programming languages page, it says that F# uses CLI. Does that mean that F# is designed for the purpose of making command-line applications and not graphical applications, or is there another meaning of CLI? ...

What is the maximum length of a C#/CLI identifier?

Which other restrictions are there on names (beside the obvious uniqueness within a scope)? Where are those defined? ...

Does PHP have threading?

I found this PECL package called threads, but there is not a release yet. And nothing is coming up on the PHP website. ...

mysql import sql via cli from remote server

i know how to import an sql file via the cli: mysql -u USER -p DBNAME < dump.sql but that's if the dump.sql file is local. how could i use a file on a remote server? ...

Windows API colored output to stdout in Powershell/cmd.exe

Anyone know where to find a reference that describes how to output color on the Windows CLI interfaces using API and/or stdout? ...

mysql charset cli

how do i determine what a mysql db's charset is set to? in the cli? ...

Linux equivalent of the Mac OS X "open" command

I've found the "open" command in Mac OS X very handy in the command line. From "man open": The open command opens a file (or a directory or URL), just as if you had double-clicked the file's icon. If no application name is specified, the default application as determined via LaunchServices is used to open the specified files. That is,...

Python's os.execvp equivalent for PHP

I've got a PHP command line program running. And I want to connect to a mysql shell straight from PHP. I've done this before in Python using os.execvp But I can't get the same thing to work in PHP. I've tried the following functions: system passthru exec shell_exec example: system('mysql -u root -pxxxx db_name'); But they all see...

Command line reserved tokens

When building an application with a CLI, it is useful to avoid using tokens that are commonly used for shell features. For example, | is used for piping output of one application to input of the next. Please supply a complete list of tokens that would need to be escaped to be used? As a minimum/summary, for each token, please identify...

PHP - how to distinguish command-line and web-server invocation?

Is there a way to distinguish if a script was invoked from the command line or by the web server? (See http://stackoverflow.com/questions/173851/what-is-the-canonical-way-to-determine-commandline-vs-http-execution-of-a-php-s for best answer and more detailed discussion - didn't find that one before posting) I have a (non-production)...

command-line world clock?

Is there a script to display a simple world clock (time in various places around the world) on a *nix terminal? I was thinking of writing a quick Python script, but I have a feeling that's gonna be more work than I think (e.g. due to config and output format) - not to mention reinventing the wheel... ...