diff --git a/install-cpp/install-script-unix.sh b/install-cpp/install-script-unix.sh new file mode 100644 index 0000000..7015d36 --- /dev/null +++ b/install-cpp/install-script-unix.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Function to check if a command is available +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# Check if g++ is already installed +if command_exists g++; then + echo "g++ is already installed." +else + # Install g++ + sudo apt update + sudo apt install g++ + + # Check if installation was successful + if command_exists g++; then + echo "g++ has been successfully installed." + else + echo "Failed to install g++." + exit 1 + fi +fi \ No newline at end of file