w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Running Perl Script from Command Line?
According to the documentation: Perl Express is not tied to a specific Perl port and should work with any build for Windows. and the system requirements: Windows 98/Me/2000/XP/2003, Perl Interpreter So you, presumably, have a separate Perl distribution already installed somewhere. That should have a perl.exe executable that you can use to run your script.

Categories : Perl

Running R script from crontab gives different results than from command line
Don't compare a string to a number if you don't have to. If you removed the space from the format pattern (i.e. made it "%H" instead of " %H"), it should work. However, you don't have to introduce strings in this case; you can get the hour as a number by converting to POSIXlt and extracting the hour component. Try this: as.POSIXlt(Sys.time())$hour > 12

Categories : R

How can i tell Java code run the script as it was running from command line as normal user?
Fist remove & from this line system("/var/tmp/runme.sh &"); Second, maybe since, you are using this: "/bin/sh", Java is running the script as different shell every time you invoke using Runtime? and you are executing /var/tmp/runme.sh from the same shell everytime. Note: /bin/sh is an interpreter and with Java Runtime you are invoking multiple instances of it to execute your script every time.

Categories : Java

Running a remote binary via a bash script is hanging if I give certain command line args
Put the ssh command in the background, not the remote command. for host in A B C do ssh user@$host " function test { cd /path/to/foo ./foo_exe --optA > run.out 2>&1 }; test" & done wait The reason is that ssh is waiting for the server to close the network connection before it exits. It doesn't go into the background just because the remote command is in the background. BTW, have you heard of pssh? http://www.theether.org/pssh/

Categories : Bash

Pycharm unit test interactive debug command line doesn't work
This is likely because your test runner is capturing stdout but not stderr. I use py.test which captures both stdout and stderr so I see no output at all. If I want to see output I have to pass the -s flag to my py.test runner which can be done by modifying the run/debug configuration and adding this flag to the options field. (Run > Edit Configurations > Defaults > Python tests > py.test > add -s to the options field.) >>> print 'a' a >>> import sys >>> sys.stderr.write('moof') moof>>> sys.stdout.write('moof') moof>>> sys.stderr.write('test') test Note: the -s flag can equally be used with nose tests

Categories : Unit Testing

How do I set a command-line flag when running a Symfony2 Command test?
disabling debug in the kernel You can initialize the kernel in your test's setUp() method with debug set to false. use SymfonyBundleFrameworkBundleTestWebTestCase; class YourCommandTest extends WebTestCase { public function setUp() { static::$kernel = static::createKernel(array('debug' => false)); static::$kernel->boot(); // ... } Have a look at WebTestCase->createKernel(). using enviroments If you don't want the debug output in your logs edit/create app/config/config_test.yml and edit ... monolog: handlers: file: type: stream level: debug # log-level ... ... to another log level that suits your needs. Then execute your command using the test environment with --env=test

Categories : PHP

How to issue a command from the command line of a process running on Linux
If you don't mind waiting for the calls to finish (one at a time) before returning control to your program, you can use the subprocess library. If you want to start something running and not wait for it to finish, you can use the multiprocessing library.

Categories : Python

Trouble running android command in command line
What Am I missing? You are missing two ~ characters, perhaps. The exact path is /Users/me/Development/adt-bundle/ That's not what you typed into your PATH. Your PATH says that there is no /Users/me -- instead, PATH is expecting a /Development directory in the root of your volume. Now, in Linux, the solution would be to add a ~ to indicate that /Development is relative to your home directory: export PATH=${PATH}:~/Development/adt-bundle/sdk/platform-tools:~/Development/adt-bundle/sdk/tools My OS X shell experience is rusty, so I forget if ~ will map to /Users/me or not. If it does, use ~, otherwise, go with: export PATH=${PATH}:/Users/me/Development/adt-bundle/sdk/platform-tools:/Users/me/Development/adt-bundle/sdk/tools

Categories : Android

Command works in command line but gives 'no such file or directory' in bash script
Remove the quotes around line 8. Like this: ./optAlg.exe "$inputFile" 500 2>&1 > "output/$outputFile" By placing quotes around the whole line you tell bash to execute a command which is called exactly ./optAlg.exe $inputFile 500 2>&1 > output/$outputFile and of course there is no such command. In reality you want to run ./optAlg.exe with parameters. Do not forget to place quotes around the variables because otherwise filenames that have whitespace characters are going to be passed as several arguments. Please read about arguments. And you can read about common pitfalls as well.

Categories : Bash

how to read multiline output command line by line, in a shell script?
Maybe I found a different solution, where I can use variables also outside the loop I have to change the default IFS to newline echo Searching for android virtual devices ... IFS=$' '; for l in $(${PROGDIR}/android list avd) ; do VAR1=$(echo $l | cut -d: -f1 | sed -e 's/s*//'); #sed removes trailing blanks if [ $VAR1 == "Name" ]; then NUM_AVD=$(($NUM_AVD+1)); fi; done echo "NUM_AVD=$NUM_AVD" In this case NUM_AVD is correctly 2

Categories : Shell

The DB2 SQL script is hanging in shell script, but working successfully in command line
Are you sure DB2 is blocking? Did you put a semicolon between commands db2 CONNECT TO ktest4 ; db2 -v -f /tmp/sql/application_system/opmdb2_privilege_remove.sql.5342 In order to trace the execution, I advise you to put some output, in order to detect where is it blocking date ; db2 -r /tmp/output.log CONNECT TO ktest4 ; db2 -r /tmp/output.log values current timestamp ; db2 -r /tmp/output.log -v -f /tmp/sql/application_system ; db2 -r /tmp/output.log values current timestamp ; db2 -r /tmp/output.log terminate With a command like this, you will save all outputs, and then you could check where is the error.

Categories : SQL

bash shell script error works on command line, not in script
Variables are supposed to contain data, and bash treats them as data. This means that shell meta-characters like quotes are also treated as data. See this article for a complete discussion on the topic. The short answer is to use arrays instead: ASCIIDOC_OPTS=( --asciidoc-opts='-a lang=en -v -b docbook -d book' ) DBLATEX_OPTS=( --dblatex-opts='-V -T db2latex' ) cmd=(a2x -v -f pdf -L "${ASCIIDOC_OPTS[@]}" "${DBLATEX_OPTS[@]}" "$1".asciidoc) # Print command in pastable format: printf '%q ' "${cmd[@]}" printf ' ' # Execute it "${cmd[@]}" Make sure not to use eval: eval "$cmd" #noooo This will appear to work with your code as you posted it, but has caveats and security problems.

Categories : Bash

Overhead in running Julia from command-line
Please see the julia-users@googlegroups.com mailing list for questions like these. This one has been answered a few times (possibly also on StackOverflow), so check the archives first. It is also generally a much better way to get current, prompt answers to questions about Julia. Yes, I just checked and it's the first related question: Julia compiles the script everytime?

Categories : Misc

wxpython GUI running a command-line program
I wrote up an article where I did something along the lines that you're talking about. I needed to run ping and traceroute and capture their output in real-time. Here's the article: http://www.blog.pythonlibrary.org/2010/06/05/python-running-ping-traceroute-and-more/ Basically you need to redirect stdout to a text control and then do something like this: proc = subprocess.Popen("ping %s" % ip, shell=True, stdout=subprocess.PIPE) line = proc.stdout.readline() print line.strip() As you can see, I use subprocess to start ping and read its stdout. Then I use the strip() command to remove extra whitespace from the beginning and end of the line before I print it out. When you do the print, it gets redirected to the text control.

Categories : Python

Error while running through command line in springs
There could be many configuration / environmental differences when running maven from Eclipse vs command line: The maven version / path. In Eclipse the actual maven binary can be default / explicitly set via preferences, whereas in command line your OS will pick the first one available on your PATH env var. Check maven version using mvn -version Maven user / global settings.xml. When running through command line typically ~/.m2/settings.xml is used but this can be explicitly overridden on Eclipse preferences Maven local repository cache. If you have discrepancy on 1 and/or 2, you could end up with different local repository cache. Incorrect artifact distribution could cause build to fail if performed against different local repository cache. Eclipse maven could use different version of J

Categories : Spring

Running a function that prompts from command line
You can pass arguments to your python program via the sys.argv list. They are passed in as strings, similar to C's argc,argv convention. Shell: $ python myprog.py 1 2 1 1 2 4 myprog.py: import sys print [int(x) for x in sys.argv[1:]] As you can see, we are using all of the members of sys.argv except the first. The first member, like argv[0] in C, is the program name. If you already have some function defined in your python program, you can add this to the bottom of the file: if __name__ == '__main__': MyFunction([int(x) for x in sys.argv[1:]]) As an alternative, if you don't want to modify your python program, and it already reads its inputs from the standard input stream, you can use shell programming: echo 1 2 1 1 2 4 | python myprog.py or, depending upon how your prog

Categories : Python

How to query running java application from command line?
Your program can use the attach API to locate the running JVM and connect to it. http://docs.oracle.com/javase/7/docs/jdk/api/attach/spec/ Then you can tell it to load an agent into the JVM. See the java.lang.instrument package description, chapter “Starting Agents After VM Startup” to see how such an agent can be implemented. This agent can call the desired method in the target JVM. Note that there already exists the JMX agent for a lot of operations you might want to perform when dealing with managing another application. It’s worth studying it.

Categories : Java

msinfo command line export only running tasks
If you can use Powershell rather than msinfo32, this is significantly easier and a lot quicker: powershell Get-Process. This runs quickly and can easily be piped to a file, e.g. powershell Get-Process > . fo.txt. This should work on any version of Windows which supports Powershell 2.0 or later, I believe. See http://technet.microsoft.com/en-us/library/ee176855.aspx for complete documentation of the Get-Process cmdlet. There are a lot of options you can use to limit the columns the cmdlet outputs, so that you don't have to parse a ton of extra columns.

Categories : Misc

Package error when running r code on command line
RStudio sets a default repository when you call install.packages from within RStudio. When you run the script via the command line, you have to tell R which repository to use (or set a global default repository). You can easily fix this problem by telling R to use your favorite repository. For example, if you want to use RStudio's package repository, set repos="http://cran.rstudio.com/" inside the install.packages call. if (!require("yaml")) { install.packages("yaml", repos="http://cran.rstudio.com/") library("yaml") } This should work!

Categories : R

-nographics alternative for MAC OSx in running unity3d from command line?
The Unity3d -nographics command line option is not available on Mac. You have complete control of the arguments you send to Unity3d through the plugin when specifying the "Editor command line arguments". What are you trying to do exactly ? Note: I am the author of the Unity3DBuilder plugin. So please report any missing feature to the plugin's issue tracker.

Categories : Osx

running SWF from the command line and getting trace output to the console
You can use the command line debugger, fdb to see console output. First, compile a debug SWF: mxmlc -debug=true myApp.mxml Then launch the debugger: java -jar ../lib/fdb.jar Then you can either launch your app in the standalone Flash Player or in a browser. When you see the (fdb) prompt, use the run debugger command to start your app. You have several choices: run <path to SWF> (launch SWF in the standalone Flash Player) run <url to SWF> or run <path to HTML file that embeds SWF> (launch in browser)

Categories : Misc

Getting output from running command line app in Inno Setup
With TLama pointing to the progress bar messages I was able to solve the problem. At first I needed to pass the progress bar handle from Inno to my C# app. For this I created a function that would return me the int-pointer as a string function GetProgressHandle(Param: String): String; begin Result := Format('%d',[WizardForm.ProgressGauge.Handle]); end; and use it in the Run-section when calling my app: [Run] Filename: "{app}myApp.exe"; Parameters: "{code:GetProgressHandle}"; .... In C# I read the int-pointer from the console arguments and use it to create an IntPtr: IntPtr pointer = new IntPtr(Int32.Parse(args[0])); To send the messages to the progress bar I imported user32.dll and re-defined the needed constants, that normally can be found in commctrl.h: [DllImport("user32.dl

Categories : C#

Running JUnit 4 from command line on Eclipse project
Just take off the .class part. Java knows to look in that file when you specify the class name. java -cp /usr/share/java/junit.jar org.junit.runner.JUnitCore MySuite

Categories : Java

Running a Java program in Eclipse as if from command line
You need to go to: Run Configuration > Argument > Program argument. Then copy and paste "inputFile.txt" "inputFile2.txt" inside the box.

Categories : Java

Display progress of a command line process that is running in MVC
I hope this link will help: Asynchronous processing in ASP.Net MVC with Ajax progress bar You can call Controller's action method and get the status of the process. Controller code: /// <summary> /// Starts the long running process. /// </summary> /// <param name="id">The id.</param> public void StartLongRunningProcess(string id) { longRunningClass.Add(id); ProcessTask processTask = new ProcessTask(longRunningClass.ProcessLongRunningAction); processTask.BeginInvoke(id, new AsyncCallback(EndLongRunningProcess), processTask); } jQuery Code: $(document).ready(function(event) { $('#startProcess').click(function() { $.post("Home/StartLongRunningProcess", { id: uniqueId }, funct

Categories : Asp Net Mvc

PHP Error encountered when running Command Line using CodeIgniter 2.xx
https://github.com/EllisLab/CodeIgniter/issues/1890 Just replace $_SERVER['REMOTE_ADDR'] with $this->server('remote_addr') at the line that generates the notice. - modify /system/core/Input.php line 351

Categories : PHP

Running 7zip command line silently via Python
Pipe stdout and stderr to your system's null file: import os with open(os.devnull, 'w') as null: subprocess.Popen(['7z', 'e', input_file, '-o', output_dest, '-y'], stdout=null, stderr=null)

Categories : Python

Using and running Tortoise svnsync in Windows via command line
When you install TortoiseSVN you are given the option to install the Subversion binaries as well: Once you do that, you will see svnsync.exe in the installation folder: As long as you have C:Program FilesTortoiseSVNin in your PATH variable, you will be able to call svnsync.exe from the command-line: (You can view your PATH variable thus (on Windows 7): Start -> right-click Computer -> Properties -> Advanced system settings -> Environment variables.... DO NOT overwrite whatever is there - simply append the path to TortoiseSVN if it isn't already there. More info here.) Hope this helps.

Categories : Windows

Running TestNG programmatically using maven command line
The simplest solution to run tests in parallel is to use the configuration for the maven-surefire-plugin like this: </plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.15</version> <configuration> <parallel>methods</parallel> <threadCount>10</threadCount> </configuration> </plugin> [...] </plugins> Usually you don't need a separate testng.xml file to run the tests, cause they will be run by default based on the naming conventions for tests. Furthermore it's not needed to make separate include rules apart from that your given definition is

Categories : Maven

Debug in Eclipse while running from command line ubuntu
Is your application written in C or in Java? If your application is in C and you are using CDT, you can attach to existing project by: Run your application from terminal. In Eclipse CDT, go to main menu "Run"->"Debug Configurations...", double-click "C/C++ Attach to Application" and press "Debug" (you should not need to specify executable and/or project). For Java applications, see this

Categories : Eclipse

MSTest execution stuck when running through command line
As Mike said in the comments, the issue was actually a bug in VS 2010 that made it impossible to run tests through the 2010 IDE if you have VS 2012 installed side by side. Unfortunately, I was unable to install VS 2010 SP1 on the build machine, but it is also possible to solve the issue by adding the /noisolation argument to the standard command line syntax (this runs the tests through the MSTest process, which somehow solves the issue). However, since you cannot define additional arguments to be passed to MSTest through TFS's integrated automated testing feature, I wrote my own application that invokes as a scheduled task, runs the tests and sends an email containing an HTML report (I used trx2html for that -- note that if you're using VS2012, you'll need the beta 0.7 version, as there'

Categories : Tfs

Run R script from command line
You need the ?Rscript command to run an R script from the terminal. Check out http://stat.ethz.ch/R-manual/R-devel/library/utils/html/Rscript.html Example ## example #! script for a Unix-alike #! /path/to/Rscript --vanilla --default-packages=utils args <- commandArgs(TRUE) res <- try(install.packages(args)) if(inherits(res, "try-error")) q(status=1) else q()

Categories : R

R script from command line
Rscript is very handy (R CMD BATCH is the old way to ) specially under windows, But generally under I create a batch file to avoid all path's headache. For example say launcher.bat: @echo off C: PATH C:ProgrammeRR-3.0.1in;%path% cd PATH_TO_YOUR_RSCRIPT Rscript tryCatch.R 1 pause And open a console(using cmd) , go where you have stored your launcher.bat and launch it. Or from the R cosnole using shell: shell('path_to_launcherlauncher.bat')

Categories : R

running a command in shell script in parallel without using background
Jobs don't "just stop" because they're backgrounded, but you have to wait for them to finish to avoid exiting the script before they're done. Documentation

Categories : Shell

Linux: No output when running a (working) command in a .sh script
Possibly because it prints its output to the stderr stream, not to stdout. Try appending 2>&1 to the end of command (after consoleLog.txt), or just use &> instead of >.

Categories : Linux

unix script, running a command on multiple files
for pdf in samples/*.pdf; do html=$(basename "$pdf" .pdf).html pdf2txt.py -o "$html" "$pdf" done If you don't have basename then try this alternative, which uses bash's ## and % constructs to do replacements inline. #!/bin/bash for pdf in samples/*.pdf; do html=${pdf##*/}; html=${html%.pdf}.html pdf2txt.py -o "$html" "$pdf" done

Categories : Shell

Running same script with different input variables using batch command
The syntax you have to use is indicated in the documentation of batch(): j = batch(fcn,N,{x1, ..., xn}) and in your case j = batch(fcn, 1, {input}) Alternatively, you can check How do I call MATLAB from the DOS prompt?

Categories : Matlab

Run PHP script from command line and max_execution_time
Yes. See http://php.net/cli and there specifically http://php.net/commandline.differences

Categories : PHP

Postgresql createdb command hanging when running from groovy script
The most likely issue would be createdb not seeing the environment variable and hanging waiting for the password. I think you have two options. The first is to continue the shell escapes and try to use a .pgpass file, but the other is to connect to the postgres (or other existing db) and create the database manually. To do this, issue the following SQL: CREATE DATABASE myDatabaseName WITH TEMPLATE template0 ENCODING utf8;

Categories : Postgresql

System Error on running a powershell command from a python script
Can you try : Watchdog_config = '"C:\Program Files (x86)\Common Files\ibm\icc\cimom\data\wmia.properties"' I'am not confortable with python, I just want to enclose path into double quotes "".

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.