When you launch a script, it runs in a new session. The alias command is being executed but it's only valid for the current session, ie during the script.
When the script finishes executing, the session it was running in is closed and you are returned to the session you were in before the script was executed, so the alias is no longer valid.
If you want to define aliases for all of your terminal sessions you have 2 options. The first is to edit your ~/.bashrc file and define the aliases there. The second option (which I use) is to create the file ~/.bash_aliases and define all of your aliases there, The default ~/.bashrc file provided with Ubuntu (and most other distros) will check for the existence of a ~/.bash_aliases file and source all of its contents if it exists. For example my ~/.bash_aliases file looks like this...
Code:
rob@raring:~$ cat ~/.bash_aliases
alias sudo='sudo '
alias ipl='get_iplayer --nocopyright'
alias gipl='get_iplayer --nocopyright --output=/home/rob/Videos --tvmode=flashhd,flashvhigh,flashhigh,flashstd,flashnormal --get'
alias hist='history | grep'
alias sv='sudo vi'
alias df='df -h -t ext4'
alias du='du -h --max-depth=1 | sort -hr'
alias ls='ls -lh --color=auto'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias pg='ps -Af | grep $1'
Bookmarks