Thanks to a posting on our mailing list I am trying out mintty, a tty shell emulator for windows which runs on top of cygwin.
So far so good, feels like the real deal.
You can install it by running “setup.exe” in the cygwin folder and install it from the package list under “shells”.
I added a couple of lines to my ~/.bash_profile
export PS1="\W> "
alias clear='echo -e "\033c"'
As there didn’t seem to be a default “clear” command to clear the terminal. Got the trick from . Also good is
To get a nice “Bash prompt here” you can install the chere package from the cygwin setup (same as above) and then run:
chere -i -c -t mintty -s bash
One oddity I’ve found is that if you execute a batch file which uses CMD.exe, CTRL+C doesn’t seem to work. It breaks out of the program but then output still appears! So you need to run .sh files in there.
My current project has a neat trick we picked up where the build has a red or green banner at the end when you run it locally to give good feedback about the build status. I’m not sure who originated it, but thanks!
I just had to tweak it a bit to get it working on OS X so I thought I would document the trick here.
It has also been run under Ubuntu where the following works (it didnt work on OS X which is why I adapted it), but the tput should also work on Ubuntu. I’ve not explicitly tested this one!
if [ "$?" -ne 0 ]; then
echo -e “\E[30;41m"
cat ./ci/failed.txt
echo -e "\E[0m"
exit 1
else
echo -e "\E[30;42m"
cat ./ci/passed.txt
echo -e "\E[0m"
exit 0
fi
Under windows you can actually make the entire screen of the terminal change color:
run.bat - WINDOWS
CALL tools\ant\bin\ant %*
IF ERRORLEVEL 1 GOTO RedBuild
IF ERRORLEVEL 0 GOTO GreenBuild
:RedBuild
color 4F
GOTO TheEnd
:GreenBuild
color 2F
:TheEnd
PAUSE
color 07