Remove pointless cat from ecc_get_value().
Quote all variables to avoid issues with spaces.
Use {push,pop}d to change directory.
Actually this echo is useless as well.