Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | www.huuphan.com

This Blog is protected by DMCA.com

huuphan.com. Powered by Blogger.

Bash script allign the output

How to use bash script allign the output. To use printf command the format of strings. Many method to allign the ouput use bash script. The script my below simple.

Bash script align the output
#!/bin/bash
for b in "H HU HUU PHAN PHANVAN"
do
        echo "$b"
        for c in $b
        do
                printf "%-50sOK\n" "$c"
        done
done

Running bash script
[[email protected] Downloads]$ ./studyscript.sh 
The display as below

Bash script allign the output

post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command | www.huuphan.com