home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.linux.gentoo      Stupid OS you gotta compile EVERYTHING      17,684 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 16,253 of 17,684   
   pk to Nikos Chantziaras   
   Re: here-documents in ebuild   
   13 Apr 08 14:16:02   
   
   From: pk@pk.invalid   
      
   Nikos Chantziaras wrote:   
      
   > I'm writing an ebuild that has a src_test() and one of the tests needs   
   > to be a here-document (command <<- EOF).  But I need to do a 'die   
   > "Failed"' call if the test fails and I can't get the syntax right.   
   > Imagine this:   
   >   
   > src_test() {   
   >      ./frob <<- EOF || die "frob failed"   
   >          foo   
   >          bar   
   >      EOF   
   > }   
   >   
   > It passes 'ebuild digest' but fails on emerge.  What's the right syntax?   
      
   Look:   
      
   $ grep aaa <<- EOF || echo "not found"   
   > bbb   
   > ccc   
   > EOF   
   not found   
   $ grep aaa <<- EOF || echo "not found"   
   > bbb   
   > ccc   
   >          EOF   
   > EOF   
   not found   
      
   Note that the shell ignores the "EOF" if it has leading whitespace.   
   My guess is that the closing "EOF" should probably go right at the beginning   
   of the line. See eg app-text/htp/htp-1.15.ebuild, which uses a similar   
   construct.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca