On Wed, Jan 30, 2013 at 06:42:01PM +0100, Gerard ROBIN wrote:
> I would like to know if to display the 3 following lines:
>
> foo bar base
> foo bar base foo bar baz
> foo bar base foo bar baz foo bar base
>
> it is the appropriate way to write:
>
> line1="foo bar base"
> line2="foo bar base foo bar baz"
> line3="foo bar base foo bar baz foo bar base"
>
> printf "%$((${#line1}+10))s\n%$((${#line2}+10))s\n%$((${#line3}+10))s\n"
> "$line1" "$line2" "$line3"
If you simply want to write a bunch of lines with indentation, you can
do it this way:
lines=(
"foo bar base"
"foo bar base foo bar baz"
"foo bar base foo bar baz foo bar base"
)
printf " %s\n" "address@hidden"
Or if what you really want is a block of text, consider using a here
document:
cat <<'EOF'
foo bar base
foo bar base foo bar baz
foo bar base foo bar baz foo bar base
EOF