[Solved] bank, 4 atm machine input txt files, syncing information between them with semaphores

I know it’s tagged c, but since you spammed it in Lounge<C++>, let me humor you with C++: Live On Coliru #include <algorithm> #include <functional> #include <atomic> #include <fstream> #include <iostream> #include <list> #include <mutex> #include <sstream> #include <string> #include <thread> #include <vector> // not thread-aware: struct Bank { struct Account { int id; int … Read more

[Solved] validating IP in bash, CentOS

Presumably you have some values for regx and presumably you are having some sort of IP list function valid_ip(){ ip=$1 if [[ $ip =~ ^$regx\.$regx\.$regx\.$regx$ ]]; then return 0 else return 1 fi } 0 solved validating IP in bash, CentOS

[Solved] Proper way to make this a shell script

in some directory of your choice do touch [script_name].sh then enter the following into the script #!/bin/bash #if not sudo or root yum fails if [ “$EUID” -ne 0 ] then echo “Please run as root” exit fi yum update -y yum install httpd -y service httpd start yum install mysql-server -y && service mysqld … Read more