Adding the handy separator to Cygwin

Separator Screen Shot

Lifehacker had a pretty neat post yesterday which added “a Handy Separator Between Commands in Your Terminal on Mac OS X and Linux.” I use a Cygwin terminal on my Windows machine, and the Linux script almost worked: the dashes didn’t print. I tracked down my particular problem to the COLUMNS variable used to calculate how many dashes to print in the separator. In my Cygwin terminal prompt, running “export $COLUMNS” showed the variable was blank; meaning that no dashes were used for the separator. Looking at the Mac modification, I noticed that it used the command “shopt -s checkwinsize” to check the window size and if necessary update the LINES and COLUMNS variables. So after adding these two lines to the beginning of the Linux “.bash_ps1” script, here https://github.com/emilis/emilis-config/blob/master/.bash_ps1, the separator worked for my Cygwin terminal.

shopt -s checkwinsize
export COLUMNS

Tags: , ,

One Response to “Adding the handy separator to Cygwin”

  1. Windows command-line tools have advanced a lot with PowerShell, but Linux has had a much more usable terminal for many years. Here’s how you can get the best of both worlds with Cygwin, a ‘nix-style terminal for Windows PCs.

Leave a Reply

Page not found - Sweet Captcha
Error 404

It look like the page you're looking for doesn't exist, sorry

Search stories by typing keyword and hit enter to begin searching.