shell

Determine whether process output is being redirected in C/C++

I'm writing command line utility for Linux. If the output (stdout) is going to a shell it would be nice to print some escapes to colorize output. But if the output is being redirected those bash escapes shouldn't be print, or the content might break parsers that rely on that output. There are several programs that do this (suck as ack) ...

is something wrong with Python Shell (Google App)?

Hi there, Python Shell - shell.appspot.com is acting weird? or am I missing something? Google App Engine/1.3.0 Python 2.5.2 (r252:60911, Apr 7 2009, 17:42:26) [GCC 4.1.0] >>> mycolors = ['red','green','blue'] >>> mycolors.append('black') >>> print mycolors ['red', 'green', 'blue'] But the below result is expected ['red', 'green',...

unix shell script to get date 30 minutes ago in GMT

Hi, I have a shell script that I want to get the date and time 30 minutes ago in GMT. I have this working great for full hours, but partial hours don't seem to work: 1 hour ago TZ=GMT+1 date +%Y-%m-%d" "%H:%M:%S 2010-01-08 17:43:57 2 hours ago TZ=GMT+2 date +%Y-%m-%d" "%H:%M:%S 2010-01-08 16:44:07 1/2 hour ago TZ=GMT+.5 date +%Y-%...

linux shell output to html

is there any way to convert bash output to html ? for example if I had some colorized output in bash ( something like htop ), how can I convert it to html tags ... ( something like this: <p style="color: red">some text</p>) ...

how can i do getRuntime().exec with asterisk?

This doesn't work, Runtime.getRuntime().exec("stat /*"); nor this; Runtime.getRuntime().exec(new String[] {"stat", "/*"}) Is there any way around it ? Thanks, ...

Programmatically access the "Open with" Windows Explorer menu list from .NET

When right-clicking a file in Windows Explorer, the "Open with" menu item displays a list of available applications, based on the file type of the clicked file. See this picture as an example: Now I want to be able to programmatically read the list of applications for a given file extension/type (e.g. "png") from within a C# .NET 2.0...

How do I change a shell scripts character encoding?

I am using Gina Trapiani's excellent todo.sh to organize my todo-list. However being a dane, it would be nice if the script accepted special danish characters like and . I am an absolute UNIX-n00b, so it would be a great help if anybody could tell me how to fix this! :) ...

How can I add items to Windows Shell (rightclick)?

I'm going to make a desktop application that will run in the background, meaning no visible window, and I'd like an option called: "Upload Text" to appear when a user right clicks a file. Can someone point me in the right direction? I also have to make sure that if someone wants to uninstall the program at any point, that the shell modi...

How to convert to a zero byte file?

HI, in unix there are number of files in my directory. i want to change all the files to zero byte files. is that possible on a single command line? for example: -rw-r--r-- 1 sumanma dev 434 Jan 8 14:36 pprbc_NL.cpp -rw-r--r-- 1 sumanma dev 488 Jan 8 14:37 pprbc_TreeBuild.cpp -rw-r--r-- 1 sumanma dev ...

How can I display the 'Send to' and 'Open With' context menus?

Some time ago I asked about how to pop up the Windows context (right-click) menu for a certain file in Delphi. However, even if everything works (almost) OK, the 'Send to...' and 'Open with...' submenus don't have any items, even if when I right-click in Explorer on the same file name they work OK. (For example, 'Send to...' has 'Desktop...

sh shell emails var/usr/email/dave forwarding

Hi, I'm new to openSuse 11.1, I have several crontab jobs running, one of which creates a dynamic list of 'at' jobs each day. Is there a way for the emails which the 'sh' shell sends to /var/usr/email/dave to be forwarded to other email addresses, my research has come up blank, mainly because I'm not sure what I'm looking for. Cheers if ...

How to catch value of parameter in Apache2 CGI

Hello folks, I have a little apache2 CGI application on the Ubuntu. The CGI handler is bash shell script. My client application is search.html: <html> <body> <form action="/cgi-bin/search.sh" method="post"> <input type="text" name="searchKey" size="10"></input> <input type=SUBMIT value="search"> <form> </body> </html> firstly...

How would you do a search from the unix shell with both constraints on the filename and the file content?

Can find perform full-text search? How would you do a search with both some constraints on the filename and the file content? ...

How to execute a windows batch command recursively?

For example, you have a rename command in a batch file, and you want to execute that file on the current directory and all sub-directories. ...

Why my bash can't execute R script ?

My script use an access to mysql to get command arguments to launch Rscript. Its use is as follows : Rscript $RFILE $ARGUMENTS (RFILE corresponding to path to Rscript, and ARGUMENTS corresponding to path file used and agr). I try, different way, but I still have errors, here a copy of my bash script : #!/usr/bin/env bash # Execute R pr...

How is bash scripting affected by the bash4 release?

bash4 looks good on paper, and I think I'll build it and give it a test drive. In the meantime... Anyone who has done the same care to share their expierence? It would be particularly interesting to hear of any issues with old bash code. ...

Automatically run a program if another program returns an error

I have a program (grabface) that takes a picture of the face of a person using a webcam, and I also have a shell script wrapper that works like this: On the command line the user gives the script the name of a program to run and its command line arguments. The script then executes the given command and checks the exit code. If there was...

how to delete mysql database through shell command

I use the pylons and sqlalchemy. I constantly update the schema files and delete the old db content (means db itself) and recreate the database so that new schema shall take place. Every time I do this by opening the MySql Query Browser and login & delete the database/schema. How to delete the mysql db/schema thorough linux shell comma...

How to run mvim (MacVim) from Terminal?

Apologies but I am new to the whole UNIX/Mac command line. I have MacVim installed and I am trying to set it up as the editor for Git (version control). But I can't run 'mvim' from the command line as it isn't recognised. I don't see an option in MacVim to do this for me. I am guessing I need to edit a PATH variable on the Mac? ...

Is there an interactive interpreter for C#?

Sometimes it's handy to have access to your language to do quick things without starting Visual Studio and creating a new console app. Is there something like Python's interactive mode or groovy shell, except for C#? ...