source:
vendor/bash/3.1-p17/examples/scripts/center
      
      | Last change on this file was 3228, checked in by , 19 years ago | |
|---|---|
| File size: 297 bytes | |
| Line | |
|---|---|
| 1 | #! /bin/bash | 
| 2 | # | 
| 3 | # center - center a group of lines | 
| 4 | # | 
| 5 | # tabs in the lines might cause this to look a little bit off | 
| 6 | # | 
| 7 | # | 
| 8 | |
| 9 | width=${COLUMNS:-80} | 
| 10 | |
| 11 | if [[ $# == 0 ]] | 
| 12 | then | 
| 13 | set -- /dev/stdin | 
| 14 | fi | 
| 15 | |
| 16 | for file | 
| 17 | do | 
| 18 | while read -r | 
| 19 | do | 
| 20 | printf "%*s\n" $(( (width+${#REPLY})/2 )) "$REPLY" | 
| 21 | done < $file | 
| 22 | done | 
| 23 | |
| 24 | exit 0 | 
  Note:
 See   TracBrowser
 for help on using the repository browser.
    
