File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22# Author: NerdOfCode
33# Purpose: Adds a few alias's that improve the efficieny of your terminal
4+
45# Tested: Linux Mint 18.1 Serena | Kernel Version 4.4.0-79-generic
6+ # Tested: Antergos | Kernel Version: 4.15.1
57
68# Storage for alias's
79storage=' .1bashrc'
1618
1719}
1820
21+ function custom(){
22+ printf " Enter custom alias: "
23+ read alias
24+
25+ echo -e " Adding:\n"
26+ echo -e " $alias \n" | tee -a ~ /$storage
27+ sleep 2
28+ echo " NOTE: you may need to manually run source ~/$storage ..."
29+ source ~ /$storage
30+ exit 0
31+
32+ }
1933
2034function add_shortcuts(){
2135 if [ -f ~ /$storage ]
2236 then
37+ echo " Shortcuts already exist..."
2338 echo " Please delete $storage and try again"
2439 exit 1
2540 fi
@@ -36,6 +51,7 @@ function add_shortcuts(){
3651 echo -e " \nNOTE: You may need to manually run 'source $storage '"
3752
3853 exit 0; }
54+
3955function remove_shortcuts(){
4056
4157 if [ -f ~ /$storage ]
@@ -44,19 +60,22 @@ function remove_shortcuts(){
4460 rm ~ /$storage
4561 exit 0
4662 fi
47- echo " The shortcuts arent installed"
63+ echo " The shortcuts aren't installed"
4864 exit 1; }
65+
4966function options(){
5067 case $response in
5168 " 1" )
5269 add_shortcuts;;
5370 " 2" )
5471 remove_shortcuts;;
55- " 4 " )
72+ " 5 " )
5673 echo " Good bye" ; exit ;;
5774 " 3" )
5875 available_commands;;
59- * )
76+ " 4" )
77+ custom;;
78+ * )
6079 echo " Unknown option selected" ;;
6180 esac
6281}
@@ -65,7 +84,7 @@ function options(){
6584clear
6685while :
6786do
68- echo -e " 1)Add the shortcuts \n2)Remove the shortcuts\n3)Show available alias's\n4)Exit"
87+ echo -e " 1)Add the shortcuts \n2)Remove the shortcuts\n3)Show available alias's\n4)Add Custom Alias\n5) Exit"
6988 read -p " Response: " response
7089 options
7190 sleep 3
You can’t perform that action at this time.
0 commit comments