delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/12/16/16:11:49

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
From: Chuck <skilover AT softhome DOT net>
Subject: Re: Piping output from sqlplus
Date: Thu, 16 Dec 2004 15:56:39 -0500
Lines: 60
Message-ID: <cpssq7$8il$2@sea.gmane.org>
References: <F76C9B2DA2FC4C4CA0A18E288BBCBCF71026EC31 AT nihexchange24 DOT nih DOT gov>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: f12d06i01.advancemags.com
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
In-Reply-To: <F76C9B2DA2FC4C4CA0A18E288BBCBCF71026EC31@nihexchange24.nih.gov>
X-IsSubscribed: yes

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Buchbinder, Barry (NIH/NIAID) wrote:
| At Thursday, December 16, 2004 3:29 PM, Chuck wrote:
|
|>-----BEGIN PGP SIGNED MESSAGE-----
|>Hash: SHA1
|>
|>I'm having a strange problem reading the output from sqlplus in
|>Cygwin. Sqlplus is a windows command line program used to access
|>oracle
|>databases. My command looks something like this...
|>
|>sqlplus -s <<! | read line
|>user/password AT database
|>set pagesize 0 linesize 200 feedback off tab off
|>select col1||chr(9)||col2
|>from table;
|>!
|>
|>This should output one line to stdout with the two values separated
|>by a tab character. The read command should read it into the variable
|>$line.
|>On my Solaris system it works perfectly. In Cygwin, $line is empty.
|>
|>If I remove the "read line", the output displays on the tty just fine.
|>
|>I though it might be related to the line end characters so I tried
|>converting them with the dos2unix filter. Didn't work. Neither did tr
|>-d \\r. Both ways, $line still ends up being empty.
|>
|>If I replace the "read line" with "od -c" to dump the characters, it
|>shows the one line as expected.
|>
|>If I redirect the output to a file, the file contains one line as
|>expected.
|>
|>If I try to read the output into a variable, I get an empty variable
|>
|>Any ideas?
|
|
| If the output shows up OK in a file, do
| VAR="$(cat file)"
|

That may work but it misses the point. I'm writing a script and I want
it to work on Cygwin and unix.

BTW the shell I'm using is ksh.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBwfaHzIf+rZpn0oQRAvKQAJ9WYJ6CbGrEeDwN9lMg2fzOIGsiOgCffjyz
BxriTOuv4IqT3zdFMHUesIY=
=jJGJ
-----END PGP SIGNATURE-----


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019