Operating System - HP-UX
1753730 Members
4741 Online
108799 Solutions
New Discussion

Re: ksh - tabs or spaces problem

 
SOLVED
Go to solution
SwissKnife
Frequent Advisor

ksh - tabs or spaces problem

Hi,

 

Here is my original version, working fine

function GetVDPparameters {
ssh -T -i ~/.ssh/delphix_key cs.delphix.target@server1<< EOF
database
select  ZZZ01
get
EOF
}

GetVDPparameters

relooking script using tabs does not work !

function GetVDPparameters {

        ssh -T -i ~/.ssh/delphix_key cs.delphix.target@server1<< EOF
        database
        select ZZZ01
        get
        EOF
}

GetVDPparameters

 

Why ? Any idea ?

Regards, Den.

 

 

4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: ksh - tabs or spaces problem

If you want leading tabs stripped in a here doc, you need a "-":

ssh -T -i ~/.ssh/delphix_key cs.delphix.target@server1 <<-EOF

Or put the EOF flush with the left.

 

SwissKnife
Frequent Advisor

Re: ksh - tabs or spaces problem

Hi, thanks for your answer. Not sure to follow you ...

 

This does not work too:

function GetVDPparameters {
        ssh -T -i ~/.ssh/delphix_key cs.delphix.target@dlx37cti1 << -EOF
        database
        select NFOT01
        get
        EOF
}

 

Regards,

Denis.

Dennis Handly
Acclaimed Contributor

Re: ksh - tabs or spaces problem

>This does not work too:

 

Hmm, then put the EOF flush to the left.  I always do.

Patrick Wallek
Honored Contributor
Solution

Re: ksh - tabs or spaces problem

You have to have the redirect as: <<- EOF

The dash goes right after the last < sigh, you had a space between the last < and the '-'.

I have used tabs in here document without any issues, however it is easier to just have the EOF at the left margin and not worrry about the '-'.