The aliases are specific to the shell, so when you run your script like this:
#!/bin/bash
...
unalias ....
...
It's running as a child shell, which will typically not have the same aliases. Compounding the problem you're also dealing with another issue. As soon as the script terminates the child shell whose aliases have been removed goes away, returning you to the parent shell which still has its aliases intact.
There is no way that I'm aware of to have your current shell's aliases modified in this manner.
So then how to do this?
You can construct an alias or a function within the scope of the current shell itself to perform this action.
Example
alias solution
$ alias unalias_local='egrep "alias [[:alnum:]]+" local_alias -o|while read i; do un$i; done'
function solution
$ function unalias_local { egrep "alias [[:alnum:]]+" local_alias -o | \
while read i; do un$i; done; }
Issues with the above
The OP provided these solutions to this answer which he stated will work in his scenario. But in general you cannot change the aliases in a chain of piped commands like this because each pipe invokes a subshell, which will not be able to touch the parent's shell. So we're back to the same problem as previously with the script.
To get around this you could supply the list of aliases as arguments to a command instead.
Example
$ alias ali1="cmd1"
$ alias ali2="cmd2"
Confirm the aliases in our shell:
$ alias | grep -E "ali[12]"
alias ali1='cmd1'
alias ali2='cmd2'
Contents of local_alias
:
$ cat local_alias
alias ali1="cmd1"
alias ali2="cmd2"
This command will parse our the names of the aliases from the file local_alias
:
$ grep -oP "(?<=alias )([[:alnum:]]+)" local_alias
ali1
ali2
We can use it to unalias
these aliases like so:
$ unalias $(grep -oP "(?<=alias )([[:alnum:]]+)" local_alias)
$
Now when we confirm that they're gone:
$ alias | grep -E "ali[12]"
$