You might consider something like (perhaps in your bash function)
while read tagname dirname ; do
pushd $dirname ;
dosomethingwith $tagname
popd
done < yourinputfile.txt
See this question (about read
in bash) and read the advanced bash scripting guide
GNU awk might be a better tool.
Notice that you can only change the current directory of the current process using the chdir(2) syscall (invoked by cd
or pushd
or popd
bash builtins). There is no way to change the directory of some other process (e.g. the parent or invoking one). The pushd
and popd
builtins also updates bash directory stack.
There is no way to change the current directory of the invoking shell (the parent process running in a terminal). But you may define your own bash function there. Read Advanced Linux Programming to understand more about Unix processes