#!/bin/bash # This line check if you run with privileges. if [[ $EUID -ne 0 ]]; then echo "The script must be executed with the sudo command or as root user" exit 1 else # Declaring variables UBUNTU_DESKTOP=" [Desktop Entry]\n Name=Ubuntu\n Comment=This session logs you into Unity\n Exec=gnome-session --session=ubuntu\n TryExec=unity\n Icon=\n Type=Application\n X-LightDM-DesktopName=Unity\n X-Ubuntu-Gettext-Domain=gnome-session-3.0\n" UBUNTU_SESSION=" [GNOME Session]\n Name=Ubuntu\n RequiredComponents=unity-settings-daemon;compiz;\n DesktopName=Unity\n" # Creating the file for the desktop entry touch /usr/share/xsessions/ubuntu.desktop echo -e $UBUNTU_DESKTOP > /usr/share/xsessions/ubuntu.desktop # Creating the file for the session entry touch /usr/share/gnome-session/sessions/ubuntu.session echo -e $UBUNTU_SESSION > /usr/share/gnome-session/sessions/ubuntu.session fi exit 1