Skip to content

Permanent command alias for Ubuntu22 and Ubuntu20 #304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion Installer/Ubuntu20/ubuntu20.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

22 changes: 21 additions & 1 deletion Installer/Ubuntu22/ubuntu22.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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