Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <030701c1dc73$56bcfb60$5100a8c0@mchasecompaq> From: "Michael A Chase" To: "Gupta, Sanjay" , References: <657B20E93E93D4118F9700D0B73CE3EA0D397231 AT goofy DOT epylon DOT lan> Subject: Re: Which OS Type Date: Thu, 4 Apr 2002 23:05:50 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 From: "Gupta, Sanjay" To: Sent: Thursday, April 04, 2002 22:34 Subject: Which OS Type > Is there any command to find out which Operating System I am using. > Basically, I need to know whether the OS is Windows type or Unix Type. The > Unix type could be any Unix e.g. Sun , HP etc , Linux etc. > > I am writing a shell script and if the shell script is run under windows > environment using cygwin, then I have to take care of some file naming > conventions for oracle sqlplus command under windows > and if the script run under unix then I have use filenames, path names > for sqlplus command in unix. > I know uname command, but is there any other command which can be more > useful in my case. > > example :- > sqlplus command in windows using cygwin. > > sqlplus scott/tiger > @c:\mydir\test.sql > > the samething in unix > > sqlplus scott/tiger > @/usr/mydir/test.sql SQL*Plus in Windows handles '/' in directory specifications just fine, so all you need to worry about is the "c:" or "/usr" part. You could test for the existence of the script file and use the first one you find. : if [ -f /usr/mydir/test.sql ]; then sqlplus scott/tiger @/usr/mydir/test.sql # Put this after any UNIX possibilities since they may # not be able to handle c: elif [ -f c:/mydir/test.sql ]; then sqlplus scott/tiger @c:/mydir/test.sql else echo "Can't find .../mydir/test.sql" exit 1 fi -- Mac :}) ** I normally forward private questions to the appropriate mail list. ** Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/