launch_random_terminal.sh

Browser view only. Use the download link if you want to save the file.

Back to Toolbox
# Array of profile names
profiles=("Mickey" "Minnie" "Donald" "Goofy")
# Get the number of profiles
num_profiles=${#profiles[@]}
# Generate a random index between 0 and num_profiles - 1
random_index=$((RANDOM % num_profiles))
# Select the profile name using the random index
selected_profile="${profiles[$random_index]}"

# Check if the script is running in a terminal
if ! tty -s; then
    # Relaunch the script in a terminal with the selected profile
    env profile="$selected_profile" mate-terminal --profile="$selected_profile" -- /bin/bash -c "\"$0\" \"$@\"; exec bash"
    exit
fi