mirror of
https://github.com/NinjaSurge/BashDungeon.git
synced 2026-04-30 11:17:37 -05:00
Update center Shortened and Optimized the /tools/center file Made more changes to the /tools/center file to make it function correctly and made its use cleaner in other files.
23 lines
442 B
Bash
23 lines
442 B
Bash
#!/bin/bash
|
|
|
|
center() {
|
|
if [[ ! $4 ]]; then
|
|
subtract=0
|
|
else
|
|
subtract=$4
|
|
fi
|
|
echo -e "\033[$(expr $(expr $(tput cols) / 2) - $(expr $(expr ${#1} - $subtract) / 2))C$2$1$3"
|
|
}
|
|
|
|
centerf() {
|
|
if [[ ! $4 ]]; then
|
|
subtract=0
|
|
else
|
|
subtract=$4
|
|
fi
|
|
printf "\033[$(expr $(expr $(tput cols) / 2) - $(expr $(expr ${#1} - $subtract) / 2))C$2$1$3"
|
|
}
|
|
|
|
centerO() {
|
|
echo "$(expr $(expr $(tput cols) / 2) - $(expr ${#1} / 2))"
|
|
} |