Padding a string with zsh

To pad a string with leading spaces in zs, you can use ${(r(15)( ))variableName).

  • r(15) pads on the right (use l for left padding)
  • The 15 defines the maximum length of the string
  • ( ) defines the character to use for padding (here, a space)

Tags : #zsh

Want to add something ? Feel free to get in touch on Twitter : @pixelastic