Count of the number of users

This commit is contained in:
Bob Mottram 2016-08-23 19:58:18 +01:00
parent 9701687ba6
commit f73be0be53
No known key found for this signature in database
GPG Key ID: 0452CC7CEA982E38
1 changed files with 5 additions and 4 deletions

View File

@ -715,14 +715,15 @@ function configure_user_interface {
cat <<EOF > $rootdir/usr/bin/list-tox-users
#!/bin/bash
users_list=\$(lstox | awk -F ' ' '{\$1=""; print \$0}' | sed -e 's/^[[:space:]]*//' | sort -d)
if [ \${#users_list[@]} -gt 0 ]; then
no_of_users=\$(echo "\$users_list" | wc -l)
if [ \$no_of_users -gt 0 ]; then
echo "\$users_list" > /home/$MY_USERNAME/Users.txt
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Users.txt
echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/Users.desktop
if [ \${#users_list[@]} -lt 2 ]; then
echo "Name=\${#users_list[@]} User" >> /home/$MY_USERNAME/Desktop/Users.desktop
if [ \$no_of_users -lt 2 ]; then
echo "Name=\$no_of_users User" >> /home/$MY_USERNAME/Desktop/Users.desktop
else
echo "Name=\${#users_list[@]} Users" >> /home/$MY_USERNAME/Desktop/Users.desktop
echo "Name=\$no_of_users Users" >> /home/$MY_USERNAME/Desktop/Users.desktop
fi
echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/Users.desktop
echo 'Comment=List of users' >> /home/$MY_USERNAME/Desktop/Users.desktop