On 03/08/2012 02:45 AM, Harry Simons wrote:
Basically, I want my scripts to be able to run flawlessly on both Fedora and Cygwin/Windows systems.

I have a universal .bashrc file that I use on Linux, Cygwin
and the occasional FreeBSD or NetBSD systems.  In it I make
use of "uname -s" to handle peculiarities like this:

 case "$(uname -s)" in
     Linux)   echo "Do Linux-specific stuff here"   ;;
     CYGWIN*) echo "Do Cygwin-specific stuff here"  ;;
     *BSD)    echo "Do BSD-specific stuff here"     ;;
     *)       echo "No support for $(uname -s) yet" ;;
 esac


I also have come to prefer the Cygwin "putclip" and "getclip"
to the Linux "xclip".  But not all platforms have both, so
this portion of my universal .bashrc protects putclip/getclip
if they exist or otherwise creates them out of xclip if it
exists.

 if [ -n "$(type -P xclip)" ]; then
     test -z "$(type -P putclip)" && \
         alias putclip="$(type -P xclip) -sel clip -i"
     test -z "$(type -P getclip)" && \
         alias getclip="$(type -P xclip) -sel clip -o"
     alias xclip='xclip -sel clip'
 fi

-Ken Jackson

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to