I would like to do following:
- get all dependencies (dir names)
- get basename of current directory
- since current directory is not a dependency, get rid of it
- print them
what I have so far (from bashrc
):
export dep=$({ tmp=$(ls /usr/local/lib/node_modules/); echo ${tmp//$(basename $(pwd))/}; })
The goal is it to have it in variable, not a function or alias becuase I want to use it later (such as for npm link $dep
), which I would not be able if it was function.
But the current output DOES include the current directory. Was it invoked from the current dir, the current dir would not be included. So I guess the variable is not reexecuted to take into account it changed its dir (from where bashrc is, to where I am now).
So how to make it to NOT include the current dir?