Files
Linux/Task_2/keydir/update_users.sh
2025-05-12 14:30:46 +02:00

24 lines
489 B
Bash
Executable File

#!/bin/bash
# Read in everything in directory
entries=$(ls)
# echo $entries # for testing
# check each item in dir
echo "Usernames:"
for entry in $entries
do
if [[ "$entry" == *.pub ]]
then
username=${entry%.pub}
usernames="$usernames $username"
fi
done
echo $usernames
sed -i "s/@demo_project_users = .*/@demo_project_users =$usernames/g" example.conf
# macOS BDS Version of the Comand
# sed -i "" "s/@demo_project_users = .*/@demo_project_users =$usernames/g" example.conf