Files
Christopher 222e6af258 🔧 refactor: Use #!/usr/bin/env bash in all shell scripts (#16)
This commit refactors all the shell scripts to use `#!/usr/bin/env bash` instead of `#!/bin/bash`. This change ensures that the scripts will run with the system's default Bash interpreter, even if it is not located at the standard `/bin/bash` path.
2024-10-23 13:32:15 -05:00

18 lines
589 B
Bash

#!/usr/bin/env bash
# Path to the configuration file
CONFIG_FILE="/etc/casaos/gateway.ini"
# Check if the configuration file exists
if [[ -f $CONFIG_FILE ]]; then
# Use grep to find the line with 'port' and use awk to print the value
PORT=$(grep '^port=' $CONFIG_FILE | awk -F'=' '{print $2}')
# Get the local IP address
IP_ADDR=$(hostname -I | awk '{print $1}')
echo "The local IP address is: $IP_ADDR"
echo "The port number is: $PORT"
echo "You can access it in the browser at: http://$IP_ADDR:$PORT"
else
echo "Error: Configuration file not found."
fi