diff --git a/Installer/Ubuntu20/ubuntu20.sh b/Installer/Ubuntu20/ubuntu20.sh index 7568d024..3fcf8590 100644 --- a/Installer/Ubuntu20/ubuntu20.sh +++ b/Installer/Ubuntu20/ubuntu20.sh @@ -250,6 +250,27 @@ chmod +x $bin echo "removing image for some space" rm $tarball clear -echo "You can now launch Ubuntu with the ./${bin} script from next time" + +### Set-up an alias to allow easy execution from any dir + +# Path to bashrc on termux +bashrc="/data/data/com.termux/files/usr/etc/bash.bashrc" + +# Get the absolute path of $bin i.e start-ubuntu20.sh +Ubuntu=$(readlink -f ./${bin}) + +# Check if the bashrc file exists +if [ -f ${bashrc} ]; + then + # Add alias to the bashrc file + echo "alias ubuntu20=${Ubuntu}" >> ${bashrc} + # Reload bashrc + source $bashrc + echo "Next time, Launch Ubuntu with this command: ubuntu20" +else + # Use previous statement if no bashrc + echo "You can now launch Ubuntu with the ./${bin} script from next time" +fi +# echo "You can now launch Ubuntu with the ./${bin} script from next time" bash $bin diff --git a/Installer/Ubuntu22/ubuntu22.sh b/Installer/Ubuntu22/ubuntu22.sh index 21d2dad3..82b3a262 100644 --- a/Installer/Ubuntu22/ubuntu22.sh +++ b/Installer/Ubuntu22/ubuntu22.sh @@ -229,6 +229,26 @@ chmod +x $bin echo "removing image for some space" rm $tarball clear -echo "You can now launch Ubuntu with the ./${bin} script from next time" + + +### Set-up an alias to allow easy execution from any dir + +# Path to bashrc on termux +bashrc="/data/data/com.termux/files/usr/etc/bash.bashrc" + +# Get the absolute path of $bin +Ubuntu=$(readlink -f ./${bin}) + +# Check if the bashrc file exists +if [ -f ${bashrc} ]; + then + # Add alias to the bashrc file + echo "alias ubuntu22=${Ubuntu}" >> ${bashrc} + # Reload bashrc + source $bashrc + echo "Next time, Launch Ubuntu with this command: ubuntu22" +else + echo "You can now launch Ubuntu with the ./${bin} script from next time" +fi bash $bin