I personally work cross platform with Windows and Linux and sometimes I edit .sh
files with Notepad++. It is hence problematic for me to keep all my files' tab indents as Unix-like so my solution was to use space-based indenting.
Yet, I encounter problem when indenting herdocs inside heredocs. For example, here is an external heredoc, holding an internal cat heredoc:
bash /dev/fd/10 10<<-'EOT'
Some command.
cat << EMW >> /etc/apache2/apache2.conf
EMW
Some other command.
EOT
As I recalled I ran this successfully with Unix-like tabbing in bash, but not with Windows-like tabbing as then the script broke and the same goes for using spaces.
My question:
My question can actually be comprised of these questions and I ask it not only for me but for other curious people to find this:
- Why can't we use spaces for indenting commands and heredocs inside other heredocs?
- If I'm wrong and there is a workaround to allow space indenting for commands and heredocs inside other heredocs, than what is it?