How to divide 100 by the amount of logged in users?
I wrote this bash script to call another script written in C that uses threads. My dedicated server can only support 100 threads being used at one time and I am going to be having multiple users on my dedicated server. I am trying to take 100 divided by the number of users logged in to my server so that each will have a fair share of threads. Example: 4 users are logged in to my server at a given time and all 4 are running my script. Each user will have an equal amount of threads that are being used. So 100/4 would be 25 threads per user. All I am trying to do is get 100 divided by the amount of users logged into my server, what would be the best way to do this? I know the 'who' command can tell you how many users are logged in but I don't really know how to use it. This should be pretty simple for most of you guys to do, I'm a Linux newbie. Cut me some slack lol.