#!/bin/bash #!/bin/bash # Function to print IP addresses using ip command function print_ips_with_ip() { echo "IP addresses on this machine:" ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' } # Function to print IP addresses using ifconfig command function print_ips_with_ifconfig() { echo "IP addresses on this machine:" ifconfig | grep -o 'inet addr:\S*' | cut -d':' -f2 } # Check if ip command is available and use it, otherwise try ifconfig if command -v ip >/dev/null 2>&1; then print_ips_with_ip elif command -v ifconfig >/dev/null 2>&1; then print_ips_with_ifconfig else echo "No tool available to find IP addresses." fi # Define the initial Bokeh server command CMD=("bokeh" "serve" "dsi-parser-frontend/" "--port" "5020" "--allow-websocket-origin" "*" "--use-xheaders" "--prefix" "dsi-parser-frontend") # Execute the command "${CMD[@]}" EXIT_STATUS=$? # Check if the command failed if [ $EXIT_STATUS -ne 0 ]; then echo "Initial Bokeh server command failed. Attempting fallback command..." # Define and execute the fallback Bokeh server command CMD=("bokeh" "serve" "./" "--port" "5020" "--allow-websocket-origin" "*" "--use-xheaders" "--prefix" "dsi-parser-frontend") "${CMD[@]}" fi