Skip to content

Commit b62b14d

Browse files
NyxnnyyxxxxChrisTitusTech
authored
Replace echos with printf and general improvements (#482)
Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com> Co-authored-by: Chris Titus <contact@christitus.com>
1 parent a151a15 commit b62b14d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tabs/common-script.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ checkAURHelper() {
2020
for helper in ${AUR_HELPERS}; do
2121
if command_exists "${helper}"; then
2222
AUR_HELPER=${helper}
23-
echo "Using ${helper} as AUR helper"
23+
printf "Using ${helper} as AUR helper"
2424
AUR_HELPER_CHECKED=true
2525
return 0
2626
fi
2727
done
2828

29-
echo "Installing yay as AUR helper..."
29+
printf "%b\n" "${YELLOW}Installing yay as AUR helper...${RC}"
3030
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel
3131
cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/yay-bin.git && "$ESCALATION_TOOL" chown -R "$USER":"$USER" ./yay-bin
3232
cd yay-bin && makepkg --noconfirm -si
@@ -49,7 +49,7 @@ checkEscalationTool() {
4949
for tool in ${ESCALATION_TOOLS}; do
5050
if command_exists "${tool}"; then
5151
ESCALATION_TOOL=${tool}
52-
echo "Using ${tool} for privilege escalation"
52+
printf "Using ${tool} for privilege escalation"
5353
ESCALATION_TOOL_CHECKED=true
5454
return 0
5555
fi
@@ -65,7 +65,7 @@ checkCommandRequirements() {
6565
REQUIREMENTS=$1
6666
for req in ${REQUIREMENTS}; do
6767
if ! command_exists "${req}"; then
68-
echo "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
68+
printf "%b\n" "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
6969
exit 1
7070
fi
7171
done
@@ -77,7 +77,7 @@ checkPackageManager() {
7777
for pgm in ${PACKAGEMANAGER}; do
7878
if command_exists "${pgm}"; then
7979
PACKAGER=${pgm}
80-
echo "Using ${pgm}"
80+
printf "Using ${pgm}"
8181
break
8282
fi
8383
done
@@ -94,14 +94,14 @@ checkSuperUser() {
9494
for sug in ${SUPERUSERGROUP}; do
9595
if groups | grep -q "${sug}"; then
9696
SUGROUP=${sug}
97-
echo "Super user group ${SUGROUP}"
97+
printf "Super user group ${SUGROUP}"
9898
break
9999
fi
100100
done
101101

102102
## Check if member of the sudo group.
103103
if ! groups | grep -q "${SUGROUP}"; then
104-
echo "${RED}You need to be a member of the sudo group to run me!${RC}"
104+
printf "%b\n" "${RED}You need to be a member of the sudo group to run me!${RC}"
105105
exit 1
106106
fi
107107
}
@@ -110,7 +110,7 @@ checkCurrentDirectoryWritable() {
110110
## Check if the current directory is writable.
111111
GITPATH="$(dirname "$(realpath "$0")")"
112112
if [ ! -w "$GITPATH" ]; then
113-
echo "${RED}Can't write to $GITPATH${RC}"
113+
printf "%b\n" "${RED}Can't write to $GITPATH${RC}"
114114
exit 1
115115
fi
116116
}

0 commit comments

Comments
 (0)