General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Winnetou17
DistroTube
comments
Comments by "Winnetou17" (@Winnetou17) on "Add Dialogs And Menus To Shell Scripts With Whiptail" video.
Hey DT! Why don't you use printf for ensuring the right amount of spaces ? That for is actually ridiculous! In both the terminal and in C, you have printf. In terminal you would use this as printf "%78s\n" "text guaranteed to ocupy 78 characters, left padded" With 78 being the minimum width, s denoting that it's a string (and the default padding is a space for strings, a zero for numbers). This way (usually the norm with numbers) the padding is added to the left of the variable outputted, (aka right aligned) and that is kind of useless in your example. For that you have to add a minus to the width specifier, like this: printf "%-78s\n" "text left aligned but still 78 characters wide" Check the GNU documentation (you can check C documentation of the function too, but there's minor subtle differences between the C function and the shell program)
2