2 replaced http://stackoverflow.com/ with https://stackoverflow.com/
source | link

This is portable:

a="$(command)"             # Get the output of the command.
b="????"                   # as many ? as characters are needed.
echo ${a%"${a#${b}}"}      # select that many chars from $a

To build a string of variable length of characters has its own question hereits own question here.

This is portable:

a="$(command)"             # Get the output of the command.
b="????"                   # as many ? as characters are needed.
echo ${a%"${a#${b}}"}      # select that many chars from $a

To build a string of variable length of characters has its own question here.

This is portable:

a="$(command)"             # Get the output of the command.
b="????"                   # as many ? as characters are needed.
echo ${a%"${a#${b}}"}      # select that many chars from $a

To build a string of variable length of characters has its own question here.

1
source | link

This is portable:

a="$(command)"             # Get the output of the command.
b="????"                   # as many ? as characters are needed.
echo ${a%"${a#${b}}"}      # select that many chars from $a

To build a string of variable length of characters has its own question here.