hello, here is a code that formats output of "mount" command:
Code:
#!/bin/bash
# mount table format
case "$#" in
0) cat /etc/mtab | awk 'BEGIN { print "filesystem mount type" }
{ printf "%10s %-20s %-12s %s\n", $1, $2, $3, $4 }'
;;
*) mount "$@"
;;
esac
fields are with defined width, and when i mount something that is wider ( iso image as loop )
it moves the other fields to the right...
i saw that "df" command prints first field and then prints other fields on the next line and they keep their position...
how to do this with "printf", or in other way??