---
date-created: 20240222
tags:
- ocp
- bash/script
---
# OCP container availability count script
```bash=
#!/bin/bash
# Prompt user for total CPU cores available
read -p "Enter total CPU cores available: " total_cpu_cores
# Prompt user for CPU request per container (in cores)
read -p "Enter CPU request per container (in cores): " cpu_request_per_container
# Calculate the maximum number of containers
number_of_containers=$(echo "$total_cpu_cores / $cpu_request_per_container" | bc)
# Output the result
echo "Maximum number of containers that can be hosted: $number_of_containers"
```