command-line

Bash script does not continue to read the next line of file

Hello all, I have a shell script that saves the output of a command that is executed to a CSV file. It reads the command it has to execute from a shell script which is in this format: ffmpeg -i /home/test/videos/avi/418kb.avi /home/test/videos/done/418kb.flv ffmpeg -i /home/test/videos/avi/1253kb.avi /home/test/videos/done/1253kb.flv f...

How to execute multiple statements in a Matlab anonymous function?

I'd like to do something like this: >> foo = @() functionCall1() functionCall2() so that when I said >> foo() it would execute functionCall1() and then execute functionCall2(). (I feel that I need something like the C , operator) EDIT: functionCall1 and functionCall2 are not necessarily functions that return values. ...

Need a better way to execute console commands from python and log the results

I have a python script which needs to execute several command line utilities. The stdout output is sometimes used for further processing. In all cases, I want to log the results and raise an exception if an error is detected. I use the following function to achieve this: def execute(cmd, logsink): logsink.log("executing: %s\n" % cmd...

Detect if running with administrator privileges under Windows XP

I am trying to work out how to detect whether a user is running with admin rights under Windows XP. This is fairly easy to do in Vista/Win7 thanks to the whoami command. Here's a snippet in Ruby for how to do it under Vista: Note, the following link now incorporates the solution suggested by muteW http://gist.github.com/65931 The trou...

Is there a good command line argument processing API for Java?

Is there library support for parsing command line arguments in Java? Preferably in the APIs that are with the default JRE, and supporting UNIX-like arguments Something along the lines of PERL's GetOpt? ...

Access denied when trying to move files with xp_cmdshell

Hi Im trying to use some T-SQL to move some files from one directory to another. Im using xp_cmdshell to call the move command Just like this: create table #output(line varchar(2000) null) insert into #output exec master..xp_cmdshell 'move /y "D:\files\*.txt" "D:\oldfiles"' But the files inst move and the #output table contains this o...

How do I identify what branches exist in CVS?

I have a legacy CVS repository which shall be migrated to Perforce. For each module, I need to identify what branches exist in that module. I just want a list of branch names, no tags. It must be a command line tool, for scripting reasons. For example (assuming there is a cvs-list-branches.sh script): $ ./cvs-list-branches.sh module1...

How can I make this one-liner work in DOS?

python -c "for x in range(1,10) print x" I enjoy python one liners with -c, but it is limited when indentation is needed. Any ideas? ...

How can I process command line arguments in Python?

What would be an easy expression to process command line arguments if I'm expecting anything like 001 or 999 (let's limit expectations to 001...999 range for this time), and few other arguments passed, and would like to ignore any unexpected? I understand if for example I need to find out if "debug" was passed among parameters it'll be ...

How can I get the command-line output of a DOS tool using Perl?

Hi, I want to meassure the throughput of a link using Windows build-in FTP tool inside a Perl script. Therefore the script creates the following command script: open <ip> <username> <password> hash get 500k.txt quit Afterwards I run the command script using the following Perl code: system(@args); @args = ("ftp", "-s:c:\\ftp_dl.txt")...

Command line GUID for Unix and Windows?

Is there a command line tool for unix and windows that uses the same algorithm to create GUIDs for both platforms? ...

Nant cmd.exe redirection creating file called 'program' on c:\ drive

Hi, I have NAnt script which as part of its project calls a batch file using the following task: <target name="makeplane"> <exec program="C:\WINDOWS\system32\CMD.EXE" commandline="/C ${make.file} &gt; ${make.log}" verbose="false" workingdir="${make.dir}" basedir="${make.dir}"> </...

Can I use perl's switches with /bin/env in the shebang line?

I want to run perl -w using env. That works fine on the command line: $ /bin/env perl -we 'print "Hello, world!\n"' Hello, world! But it doesn't work on the shebang line in a script: #!/bin/env perl -w print "Hello, world!\n"; Here is the error: /bin/env: perl -w: No such file or directory Apparently env doesn't understand the -...

Passing exclamation point to java program on command line

I want to pass the string "!changeme!" to a java program on the command line like: java -cp "!AXIS2_CLASS_PATH!" ClientJava --userid admin --passwd "!changeme!" Using Windows XP, Java jdk 1.6.0_07. The AXIS2_CLASS_PATH gets replaced as normal, I assume by the java runtime. However the password of !changeme! also seems to be replaced...

Is there a standard command-line tool for unix for piping to a socket?

I have some applications, and standard Unix tools sending their output to named-pipes in Solaris, however named pipes can only be read from the local storage (on Solaris), so I can't access them from over the network or place the pipes on an NFS storage for networked access to their output. Which got me wondering if there was an analogo...

Pause in Python

I am running commandline python scripts from the Windows taskbar by having a shortcut pointing to the python interpreter with the actual script as parameter. After the script has been processed, the interpreter terminates and the output window is closed which makes it impossible to read script output. What is the most straightforward w...

Compile Flex Builder project from command line

Is there an easy way to build projects created in FlexBuilder via the command line? I'm beginning to work on adding a couple Flex components to the project I have at work. Currently the rest of the project (some java, some C++) is built via an ant script. I'd really like to be able to integrate the builds for the Flex components I'm w...

WAMP - PHP shell_exec() problem

I'm using WAMP as a server, and I have a need to execute svn, which can be found in my Windows directory: C:/Program Files/Subversion/bin/ The problem, is that when I launch the php program from the server, it won't produce output. It works from the command line, which makes me think this is a permissions problem with WAMP. However afte...

How do I programatically change the create, modify, access date on a file?

I need to change the modify date on a file in windows so that it doesn't clutter up my sort order. How can I do that with a script (I may need to do that to the file in the future as well)? thanks. BTW: I don't want to have to install apps to do this. ...

Why do I get an amibguity error when I compile from the command line, but not from the IDE?

I am trying to compile a rather large project with Borland C++ Builder 5.5. The project compiles in the IDE, but is much too slow. However, when I compile with the command line I get an ambiguity error that was not present in the IDE: Error E2015 Project.h 536: Ambiguity between 'TTreeNode' and 'Comctrls::TTreeNode' My command line a...