I have a bash script that echoes paragraphs of text. I want them to be indented.
Example:
echo "Something"
echo -e "\tfoo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo"
Will print something like this:
Something
foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo foo foo foo foo
But what I want is this:
Something
foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo foo foo foo foo
I prefer to avoid having to line-break many such paragraphs by hand.
I've seen all sorts of techniques using sed
and so on, but I need to rely on shell builtins only (should be as simple as possible).
UPDATE
Put it this way- how do the man
pages (for any random command) format all those paragraphs so nicely? Surely they were not line-breaked by hand? And I assume they didn't use anything other than builtins when documenting the basic commands?