shell

What does my project need to reference in order to use the Windows shell?

Specifically, I want to use IShellFolder, IExtractImage and ShellInterop in order to extract thumbnails from PDF and DOC files. Also, the namespace I need to import would be handy too Thanks so much for taking a look at this newbie question :) Iain ...

Shell script to process files

I need to write a Shell Script to process a huge folder of nearly 20 levels.I have to process each and every file and check which files contain lines like select insert update When I mean line it should take the line till I find a semicolon in that file. I should get a result like this C:/test.java select * from dual C:/test.java ...

How safe is it to use Drush?

Since this is a beta-1 release, Is there anything which I should especially be worried about? ...

SVN - Get all commit messages for a file?

Is there a way to get a nice list of all commit messages sorted by file? Something like this (as you can see, I don't want the messages specific to a certain file, just show messages for the entire commit if the file was part of the commit, repeats ok): -- index.php 2010-01-02 03:04:05 * added new paragraph 2010-01-01 03:0...

[UNIX] Sort lines of massive file by number of words on line (ideally in parallel)

I am working on a community detection algorithm for analyzing social network data from Facebook. The first task, detecting all cliques in the graph, can be done efficiently in parallel, and leaves me with an output like this: 17118 17136 17392 17064 17093 17376 17118 17136 17356 17318 12345 17118 17136 17356 17283 17007 17059 17116 E...

Shell script query

Hi, I am having database. for that i want to get the script of all Store procedure. I have used dba_source table for getting script of Store procedure. Now I want to write a shell script which will give me all the scripts of store procedure in the seperate files. The approach i have applied that first I have written a query which will g...

Unfold vCard lines in shell

vCard lines can be folded by inserting "\r\n " (that's a space at the start of the new line), but I'm struggling to unfold them with the line-oriented GNU tools (sed, cut). Any ideas? Effectively, from the string foo bar baz ban bay bal it must return foobar baz banbaybal ...

How do i pass null into stdin like this perl code?

This is my question and apparently this is the answer. Turns out it was a buffer problem (solution in the accepted answer of my ffmpeg link) not stdin. I found you can stdout to null by writing > NUL in command prompt so i tried writing < NUL at the end of my argument. No luck. How do i pass in null or do something with the IO locks li...

"Bootstrap" python script in the Windows shell without .py / .pyw associations

Sometimes (in customer's PCs) I need a python script to execute in the Windows shell like a .CMD or .BAT, but without having the .py or .pyw extensions associated with PYTHON / PYTHONW. I came out with a pair of 'quick'n dirty' solutions: 1) """ e:\devtool\python\python.exe %0 :: or %PYTHONPATH%\python.exe goto eof: """ # Python test...

Temporary operation in a temporary directory in shell script

I need a fresh temporary directory to do some work in a shell script. When the work is done (or if I kill the job midway), I want the script to change back to the old working directory and wipe out the temporary one. In Ruby, it might look like this: require 'tmpdir' Dir.mktmpdir 'my_build' do |temp_dir| puts "Temporary workspace is ...

": > file" VS "> file"

Is there any differences between ": > file" and "> file"? $ : > file.out $ ls -l file.out -rw-rw---- 1 user user 0 Mar 18 21:08 file.out $ > file.out $ ls -l file.out -rw-rw---- 1 user user 0 Mar 18 21:08 file.out ...

UNIX, get environment variable

Hi SO I have a ridiculous question due to a ridiculous problem. Normally if I want to get the contents of an environment variable in UNIX shell, I can do echo ${VAR} Let's assume, due to my ridiculous situation, that this isn't possible. How do I get the contents of an environment variable to stdout, without someone who is lookin...

Rapports in a log file with a script shell (linux batch) and redirection

Hi All, Please help!!! ;) I have a problem with this code in a batch file (Linux): Mil=`date +"%Y%m%d%H%M%S"` batch=`echo "${DatMusic}"` TabimportEnteteMusic="importentetemusic.dat" { grep '^ENTETE' ${IMPORT}/${DatMusic} > ${IMPORT}/$TabimportEnteteMusic mysql -u basemine --password="basemine" -D basemine -e "delete ...

pattern matching

Hi every body Consider the following rules: register * delete * suppose now if I send a message to the application (via mobile using SMS) that will match the rules register Leon Eric now we have two parameter Leon and Eric and the application will assign %P1% for Leon and %P2% for Eric , for further use. it can be more paramete...

IContextMenu::GetCommandString Not showing help text in Windows Explorer

Hi, i am implementing a shell context menu for windows explorer and have successfully created the menu's. What i am having trouble with is the IContextMenu::GetCommandString method that displays the help text in the status bar when you hover over the selected menu item. When i do hover over each item nothing is displayed, but whats weir...

ksh: assigning function output to an array

Why doesn't this work??? #!/bin/ksh # array testfunc() function testfunc { typeset -A env env=( one="motherload" ) print -r $env return 0 } testfunc # returns: ( one=motherload ) typeset -A testvar # segfaults on linux, memfaults on solaris testvar=$(testfunc) # segfaults on linux, memfaults on solaris print $...

Signal Handling in C

How can I implement signal Handling for Ctrl-C and Ctrl-D in C....So If Ctrl-C is pressed then the program will ignore and try to get the input from the user again...If Ctrl-D is pressed then the program will terminate... My program follows: int main(){ char msg[400]; while(1){ printf("Enter: "); fgets(msg,400,stdin); prin...

Pipe multiple files (gz) into C program

I've written a C program that works when I pipe data into my program using stdin like: gunzip -c IN.gz|./a.out If I want to run my program on a list of files I can do something like: for i `cat list.txt` do gunzip -c $i |./a.out done But this will start my program 'number of files' times. I'm interested in piping all the files in...

Want to improve my simple site/db backup script with auto removal of old backups.

I have the following simple script for backing up my website files and db. The script is run each day via a cron job. #!/bin/sh NOW=$(date +"%Y-%m-%d") mysqldump --opt -h localhost -u username -p'password' dbname > /path/to/folder/backup/db-backup-$NOW.sql gzip -f /path/to/folder/backup/db-backup-$NOW.sql tar czf /path/to/folder/bac...

idioms for returning multiple values in shell scripting

Are there any idioms for returning multiple values from a bash function within a script? http://tldp.org/LDP/abs/html/assortedtips.html describes how to echo multiple values and process the results (e.g., example 35-17), but that gets tricky if some of the returned values are strings with spaces in. A more structured way to return woul...