Mail Archives: cygwin/2002/04/05/13:06:45
Thanks Michael,Robet , Randall and Prentis
It is good to know that sqlplus in windows handles '/' in directory
specification. I guess your suggestion will not work in my case. In my shell
script, a sql file is dynamically generated. see example
echo "select * from dual;" >> /tmp/test.sql
The above command will work in all type of Unix but when I want to run the
same sql command file in sqlplus.
This command will not work in windows but will work in Unix .
sqlplus scott/tiger @/tmp/test.sql
I have to convert the file name /tmp/test.sql to windows using cygpath and
then it would work in sqlplus windows.
I think using uname will be better approach.
Thanks
Sanjay
----------------------------------------------------------------------------
----------------
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
-----Original Message-----
From: Michael A Chase [mailto:mchase AT ix DOT netcom DOT com]
Sent: Thursday, April 04, 2002 11:06 PM
To: Gupta, Sanjay; cygwin AT cygwin DOT com
Subject: Re: Which OS Type
From: "Gupta, Sanjay" <SGupta AT Epylon DOT com>
To: <cygwin AT cygwin DOT com>
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/
- Raw text -