I am using Xilinx ISE, a program that requires to source a vendor script to setup the path for all its tools. Since this script breaks some functionalities of my shell I do not want to source it on the start of the shell but only when I need it.
To do so I had setup an alias for source /long/path/to/script
.
For convenience I would like it if the tools provided by the program would just always work without the setup script. The Idea is to have aliases like the following for each of the n programs (for the sake of example lets assume they are named p1,...,pn)
alias p1='source /long/path/;unalias p1;...;unalias pn;p1'
Since there are many programs I want to ease the updating of the unalias chain.
The Idea is to have alias iseRemoveSetup='unalias p1;...;pn'
. To make the building of the aliases for the programs and iseRemoveSetup
easier I defined a few functions. However if I call iseAddToRemoveCall
from the alias command (here for analyzer
) it does not have any effect. If I call it directly on the shell however it works fine.
Below is the relevant part of my .bashrc
:
alias iseRemoveSetup=''
function iseAddToRemove() {
alias iseRemoveSetup=`(alias iseRemoveSetup | cut -f2 -d "'")`"unalias $1;"
}
function iseAddToRemoveCall() {
iseAddToRemove $1
echo "iseRemoveSetup;$1"
}
alias setupise='source /home/ted/Xilinx/tools/14.7/ISE_DS/settings64.sh'
alias analyzer='setupise;'`iseAddToRemoveCall "analyzer"`
I am aware that it would be an Idea to have a function like:
function iseAlias() {
alias $1='setupise;'`iseAddToRemoveCall $1`
}
However I want to have the issue I described above fixed first. The issue becomes visible when I run type iseRemoveSetup
, it outputs:
iseRemoveSetup is aliased to `'
...;unalias pn;
in the alias definition good for? Scripts (and binaries) don't use the aliases of the calling shell anyway. – Hauke Laging Dec 9 '14 at 13:26alias iseRemoveSetup | cut -f2 -d "'"
supposed to be? – Hauke Laging Dec 9 '14 at 13:55source /home/ted/...
once after that my path is fixed to include the tools. Therefore just runninganalyzer
is enough, no need to source again. The script also adds older libraries to the linker path and some programs cant deal with these older libraries. – ted Dec 9 '14 at 14:14.
iseAddRemoveCall` doesn't appear anywhere else. Is that supposed to beiseAddToRemoveCall
? – Hauke Laging Dec 9 '14 at 14:22