shell

Deploy visual studio isolated shell app with chained installer

Hi, I have developed a visual studio isolated shell application. When deploying that application, I first have to make sure that the redistributables for the isolated shell are installed. I have the exe containing the redistributables (which can be executed as quite install) and my msi file. Now I need a setup.exe which chains these in...

list of methods for python shell?

You'd have already found out by my usage of terminology that I'm a python n00b. straight forward question: How can i see a list of methods for a particular object in an interactive python shell like i can in ruby (you can do that in ruby irb with a '.methods' after the object)? ...

Red hat compatibility

The following code works as expected on CentOS and Ubuntu O/s but not on Red hat. What changes needs to be made? CentOS release 5.3 (Final) Linux ubuntu 2.6.24-19-generic #1 SMP Wed Jun 18 14:43:41 UTC 2008 i686 GNU/Linux #!/bin/bash depot=$1 table=$2 database=$3 combined="$depot$table" if [ "$table" = 'routes' -o "$table" = 'other_r...

Broken pipes and tee?

The output of this echo is not passed on to the next command using pipe. echo 'set foreign_key_checks = 0; truncate table saurabh.bus_services;' | mysqldump --compact --no-create-info -h192.168.950.180 -uroot -p live pnlbus | more I want the set and truncate commands followed by the dump output. ...

Getting user input after stdin has been redirected, in a bourne script

...

Is there a bash shortcut for traversing similar directory structures?

The Korn shell used to have a very useful option to cd for traversing similar directory structures e.g. given the following directorys /home/sweet/dev/projects/trunk/projecta/app/models /home/andy/dev/projects/trunk/projecta/app/models Then if you were in the /home/sweet.... directory then you could change to the equivalent director...

How can I detect if the screen is locked or screensaver is active from the Terminal in OS X 10.6?

Due to the new limitations of Kerberos in OS X 10.6, I'm working on a script that offers similar functionality to what used to be available in 10.5. Essentially it parses the klist output to see if your ticket is expiring and displays how long until it expires. If we hit the 10 minute mark, it calls kinit to do a GUI password prompt to...

Unexpected behavior when calling a Ruby script via PHP's shell_exec()

I have a Ruby script that's being used to do some API calls/screen scraping, but our main app is in PHP. Our PHP app is using shell_exec() to call the Ruby script. The ruby script works great when called from the command line–but it will randomly exits early when called via PHP's shell exec. Here's an example of the Ruby script: #!/...

On a Mac, within the shell, how can I tell that I have a GUI?

Because you (lovely) people are always so curious about posters' original intents, here's mine: If I'm on a Mac and have a GUI (as opposed to, say, being on an ssh session), I want to set my $EDITOR to mate_wait. (And go with vim otherwise.) And, you have an answer for that. I do too. It even works. Here. Sometimes. So I want you...

how to cut columns of csv

I have a set of csv files (around 250), each having 300 to 500 records. I need to cut 2 or 3 columns from each file and store it to another one. I'm using ubuntu OS. Is there any way to do it in command or utility? ...

Valid path not so valid in Vista using ParseDisplayName. Why?

In the following code example... where filePath is: "E:\[D]\My Collection" (a folder generated by picasa when it archives media) works okay on XP (32-bit). I recent ran this on vista 64-bit... and ParseDisplayName errors with "Value does not fall within the expected range." All other folders (without the '[D]') work okay. Any help wou...

Validating Variables in Shell Script

What is the best way to make sure that all the environment variables I need for my script have been set? Currently, I have multiple if-statements which is not very neat: if [ -z "$VAR1" ] then echo VAR1 not set exit fi if [ -z "$VAR2" ] then echo VAR2 not set exit fi if [ -z "$VAR3" ] then echo VAR3 not set exi...

How do I execute a PHP shell script as an Automator action on Mac OS X

Hi, I'm tempted by Automator.app's ability to create contextual services in Mac OS X Snow Leopard. I would like to create some keyboard accessible shortcuts to manipulate text snippets by calling a shell script. However, Automator only suggests bash, Perl, Python and Ruby (among others) to allow this. But, since PHP also ships with Mac ...

ASP.NET: Execute an external executable doesn't work

I need help with the code below. I try to convert a AutoCAD file from the format dwg to the format dwf. Then, the dwf file is downloaded and opened on the client computer using a java applet. The command used to convert the dwg file on the command-line is: C:\inetpub\wwwroot\COR-Basic\cadviewer\converter\ax2008.exe -i="C:\inetpub\wwwroo...

Shell script test

I'm tring to update a bash script written by someone else and I've come accross a line I'm not sure about. Can anyone tell me what the following check does: if [ :$RESULT != :0,0 ] I assume it's checking for some value in $RESULT, possibly with a substring? Any help appreciated! ...

YYYY-MM-DD format date in shell script

I tried using $(date) in my bash shell script, however I want the date in YYYY-MM-DD format. How do I get this? ...

calling uniq and sort in different orders in shell

is there a difference in the order of uniq and sort when calling them in a shell script? i’m talking here about time- and space-wise. grep 'somePattern' | uniq | sort vs. grep 'somePattern' | sort | uniq a quick test on a 140 k lines textfile showed a slight speed improvement (5.5 s vs 5.0 s) for the first method (get uniq values a...

Subversion post-commit hook to update 'staging' version not working

We have a staging version of our web application (it is basically a subversion working copy that no-one works on) that lives in '/apps/software'. Each developer has their own working copy in '~/apps/software'. I would like to utilise a simple post-commit hook script to update the staging copy every time a developer commits a change to th...

Want to invoke a linux shell command from Java

I am trying to exec some linux commands from Java code. Actualy the code that I use is useing redirection (>&) and pipe simbols (|). How my Java code should be to be able to invoke that command as in csh or bash. Thanks in advance. P.S. I have used: Process p = Runtime.getRuntime().exec("shell command"); but this code is not OK with...

in csh and tcsh shell how to view only first n lines of the file?

I tired head +10 and it didn't work. thanks ...