If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > ksh93 & Here document

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-28-04, 11:39
ddjen11 ddjen11 is offline
Registered User
 
Join Date: Oct 2004
Posts: 5
ksh93 & Here document

Hi,

I am having a problem with the Here doucment under ksh93. A simple script:

cat << EOF
testing 123
EOF

This runs fine under ksh, under ksh93 there's no output.

Has anyone run into this problem?

Thanks,
David
Reply With Quote
  #2 (permalink)  
Old 10-28-04, 12:23
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
remove space between '<<' and 'EOF'
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #3 (permalink)  
Old 10-28-04, 12:26
ddjen11 ddjen11 is offline
Registered User
 
Join Date: Oct 2004
Posts: 5
thanks for the suggestion. now the script looks:
cat <<EOF
testing 123
EOF

still does not work under ksh93.

Thanks.
Reply With Quote
  #4 (permalink)  
Old 10-28-04, 12:29
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
what do you expect it to do AND what is it doing now?
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #5 (permalink)  
Old 10-28-04, 13:11
ddjen11 ddjen11 is offline
Registered User
 
Join Date: Oct 2004
Posts: 5
put this into a scipt & run:
cat <<EOF
testing 123
EOF


under ksh you get 1 line of output:
testing 123

under ksh93 there's no output.

Thanks
David
Reply With Quote
  #6 (permalink)  
Old 10-28-04, 13:45
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
how do you run it undet ksh93?
When you 'put this ina script'.... do you specify '#!/pathTOksh93' as the interpreter?
Or you simply don't specify the interpreter at all and run the 'script' from the ksh93 command prompt?

On the related note: are you sure however you run script under ksh93 it [script] is actually using /bin/cat? Check your $PATH and aliases for ksh93 - you might b eusing some other 'cat' [no pun intended].
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #7 (permalink)  
Old 10-28-04, 15:36
ddjen11 ddjen11 is offline
Registered User
 
Join Date: Oct 2004
Posts: 5
I included the path, please try :

#!/bin/ksh
/usr/bin/cat <<EOF
testing 123
EOF

and

#!/bin/ksh93
/usr/bin/cat <<EOF
testing 123
EOF
Reply With Quote
  #8 (permalink)  
Old 10-28-04, 16:12
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
sorry, I don't have k93 here, but on Solaris /usr/dt/bin/dtksh I think IS ksh93 and it works ok.

just for kicks... try:

#!/bin/ksh93
/usr/bin/cat - <<EOF
testing 123
EOF

What OS are you on anyway?
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #9 (permalink)  
Old 10-28-04, 17:47
ddjen11 ddjen11 is offline
Registered User
 
Join Date: Oct 2004
Posts: 5
still did not display anything.
we are on AIX 5.2.

thanks for the help anyway. I apprciate your kindness in helping.
Reply With Quote
  #10 (permalink)  
Old 10-28-04, 18:04
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
this is VERY strange - unfortunately I don't have AIX where I'm.
I assume you've already checked for any 'invisiable' characters leading to the closing 'EOF' and to the openning 'EOF'.

This is a wild guess, but I'd try using a single character say '!' instead of 'EOF' - I'm grasping for straws, but.... This is something extremely basic for ANY shell.
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #11 (permalink)  
Old 10-29-04, 04:19
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
I have absolutely no problem running this in ksh93 on AIX version 4...

$which ksh93
/usr/bin/ksh93
$ksh93
$cat << EOF
> testing 123
> EOF
testing 123
$echo $0
ksh93
$
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On