Skip to content

Outside bottle warning

Joel Pearson edited this page Feb 23, 2022 · 3 revisions

I use this code in my .zlogin to ensure that I don't accidentally run a session outside the genie bottle when I didn't mean to, and vice versa:

# Display bottle warning                                                                                                            
if [[ -v INSIDE_GENIE ]]; then                                                                                                        
  echo -e "\e[92m * Safely within bottle.\e[39m"                                                                                    
else                                                                                                                                  
  echo -e "\e[97;101m * WARNING: Operating outside genie bottle. Systemd-dependent functions won't work.\e[39m \e[0m"                          
fi