Craig wrote:
> In my Bash scripts, I indent using spaces instead of tabs but I'd still like 
> to get this behavior. Why not strip leading whitespace?
> 
> Thanks,
> Craig

I do as well. The only problem is if it stipped *all* leading whitespace, 
then how would we go about indenting text within the heredoc itself?

If you're using vi to write your shell scripts, this is what I do:

- Indent the heredoc (let's say 4 spaces).
- Use a substitution to replace the 4 spaces with tab characters.
    
:s/\v\s{4}/\t/

Specify a range to suit your case.
Assuming you're using 4-space indentation, this will replace them with tabs.
This allows you to get the same effect of having a visually indented heredoc
while still stripping the indentation for 



Reply via email to