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

Bash script allign the output

My post, the example bash script how to 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 allign the output







The bash script 
#!/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 
As the output 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