Showing posts with label Shell Script. Show all posts
Showing posts with label Shell Script. Show all posts

Monday, January 11, 2010

Setting Environment Variables with Shell Script from within Cygwin

I experienced the Problem that within Cygwin Environment Variables were not set after the script finished even if I called "export".
For Expample the following Shell Script (my_environment.sh) didn't work.

#!/bin/sh
MY_VARIABLE="Hello"
export MY_VARIABLE
after calling the script, there was no error message, but an "ECHO $MY_VARIABLE" didn't output the expected result.
Within Cygwin you have to call the shell script the following way, to persist the resulting variables:
source my_environment.sh

Thursday, March 06, 2008

Eclipse WickedShell

Found a nice Eclipse-Plugin which implements the console in Eclipse. It also allows you to "collect" your favourite batch files. Furthermore it supports different console types. For Example you can also use your installed cygwin console.
www.wickedshell.net

Wednesday, October 17, 2007

Regular Expression for IP-Format

Here is the Regular Expression for the IP-Format. I used it for grepping different IPs from Apaches access.log

[0-9]*[0-9]*[0-9][.][0-9]*[0-9]*[0-9][.][0-9]*[0-9]*[0-9][.][0-9]*[0-9]*[0-9]

The only limitation is, that it's not delimited to 255.255.255.255 --> IP 999.999.999.999 will also be found :-)

Monday, July 09, 2007

Automated FTP-Put in Shell-Script

If you want to make an automated FTP-Put just use the next few lines in your Shell-Script.

#!/bin/sh
echo -e "open ftp.example.com\nuser ftpuser ftppasswd\nbin\ncd toDirectory\nput file.example" |ftp -n