You can do this with shell, as long as you seperate the commands with a ";" (in unix anyways)
ex: I do this all the time with my code
cd <somedir>;grep stuff <filename>
ex: I do this all the time with my code
cd <somedir>;grep stuff <filename>