shell

C#: Problem running shell commands

I'm trying to get the PHP parser to run a page and then return the results to my server, however when I run the command via my code, it returns nothing. I know the command is correct because if I run it manually with the same path, it works fine. Heres my code: var p = new Process { StartInfo = new ProcessStartInfo("C:\\xampp\\php...

In the bash shell, what is " 2>&1 "?

In a unix shell, if I want to combine stderr and stdout into the stdout stream for further manipulation, I can append the following on the end of my command: 2>&1 So, if I want to use "head" on the output from g++, I can do something like this: g++ lots_of_errors 2>&1 | head so I can see only the first few errors. I always have t...

Zipping files through shell_exec in PHP: problem with paths.

I'm working on a web backup service part of which allows the user to download a zip file containing the files they have selected from a list of what they have backed up. The zipping process is done via a shell_exec command. For this to work I have given the apache user no-password sudo privileges to the zip command. My problem is, sin...

import from external lib jython

I am trying to imported a java class from an external lib in jyhon and it does not work. An example package run; import import.Imported; Class Run() { public static void main(String[] args){ pi = new PythonInterpreter(null); pi.execfile('script.py'); } } //this is an external...

Combining 2 .csv files by common column.

So I have two .csv files where the first line in file 1 is: MPID,Title,Description,Model,Category ID,Category Description,Subcategory ID,Subcategory Description,Manufacturer ID,Manufacturer Description,URL,Manufacturer (Brand) URL,Image URL,AR Price,Price,Ship Price,Stock,Condition The first line from file 2: Regular Price,Sale Price...

SSH Windows to UNIX

I built a batch file from my windows machine that connects to a UNIX server. I Then want commands to execute in UNIX from the batch file. UNIX doesn't seem to recognize my commands after I am logged into the server. This is what I coded: ssh SERVERNAME exit Right now, I am just trying to make it log in and exit. I get logged into the s...

Windows command line tool analagous to UN*X "tail" command?

Hi, The tail command on the DOS does not seem to be recognized on my XP. Any suggestions on printing last few lines on a very big log file on DOS. Thanks Arun ...

How do I tell Zsh to write the current shell's history to my history file?

I work in a place that has gazillions of tools which require tons of options, so I rely on my shell's history significantly. I even back it up every now and then just to make sure I don't lose useful, lengthy commands. I just typed one of these commands and I want to make sure it's flushed to the history file, but I have a long-running ...

what is Visual Studio 2008 Shell (integrated mode)?

Hello everyone, I am new to Visual Studio 2008 Shell (integrated mode), I just want to know what is its function? (I did not find much clearly from the web.) From http://msdn.microsoft.com/en-us/vstudio/bb510103.aspx looks like it is some interface/framework to allow tools to integrate with VSTS IDE. My question is whether any Microsof...

How to write a shellscript date check that will not To run Except 3rd week sat, Sunday and 4th week Monday of the month.

E.g. the schellscript will not run on april 18, 19 and 20 and then for may is 16, 17 and 18 and so on Thanks ...

Tricky brace expansion in shell

When using a POSIX shell, the following touch {quick,man,strong}ly expands to touch quickly manly strongly Which will touch the files quickly, manly, and strongly, but is it possible to dynamically create the expansion? For example, the following illustrates what I want to do, but does not work because of the order of expansion: T...

How to recognize whether a script is running on a tty?

I would like my script to act differently in an interactive shell session and when running with redirected stdout (for example when piped to some other command). How do I recognize which of these two happen in a Python script? Example of such behavior in existing program: grep --color=auto highlights matches when running in interactive...

What is the closest thing to grep that comes standard on a Windows install?

I'd like to do something like "dsquery * | grep asdf" on a Windows machine that I can't install anything on. Any ideas? Thank you. ...

Getting correct shell verb text for action...

I've been looking over the following VB code: http://www.codeproject.com/KB/vb/toggleNetworkConn.aspx If you look under "The Methods", you'll see that he does a test to see whether or not the shell item verb is either "En&able" or "Disa&ble" - it looks pretty obvious that these are the same text strings that are listed in the right-cli...

Python: Plugging wx.py.shell.Shell into a separate process

I would like to create a shell which will control a separate process that I created with the multiprocessing module. Possible? How? EDIT: I have already achieved a way to send commands to the secondary process: I created a code.InteractiveConsole in that process, and attached it to an input queue and an output queue, so I can command t...

Print fifo content and exit

I need to print the content of a fifo (named pipe) to standard output. I could use the command: cat fifo The problem is that cat doesn't return. It stays running, waiting for more content coming from the fifo. But I know there wont be any more content coming for a while so I just want to print what's available. Is there a command tha...

Creating a new terminal/shell window to simply display text

I want to pipe [edit: real-time text] the output of several subprocesses (sometimes chained, sometimes parallel) to a single terminal/tty window that is not the active python shell (be it an IDE, command-line, or a running script using tkinter). IPython is not an option. I need something that comes with the standard install. Prefer OS-a...

How can I switch from CMD.exe to Powershell?

I have this idea that I should switch over from cmd.exe to powershell. It's so much more powerful than the tried and tested cmd.exe. It is the shell of the future for Windows. But my facility in powershell is so limited, in comparison with cmd.exe. Around every corner I discover another seemingly small obstacle that is insurmountable...

Is it bad practice to disable OS-based 'Features'?

One thing that I can't get my head around is the persistent questioning here, and elsewhere on the web, about disabling OS-based 'features'. People are forever asking how to disable default OS shortcuts (like copy-paste, the Windows key, etc.), or disabling features programmatically. Surely this is very, very bad practice? To modify a...

Change current directory from a script

Hi, everybody! Is it possible to change current directory from a script? I want to create a util for directory navigation in bash. I have created a test script that looks like the following: #!/bin/bash cd /home/artemb When I execute the script from the bash shell the current directory doesn't change. Is it possible at all to change...