Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # this is pid of the bash we are in
- bash_pid=$$
- bash_pid=$(echo -e ${bash_pid} | tr -d '[[:space:]]');
- # this is shell of the bash
- shell_pid=$(ps -p ${bash_pid} -o ppid=;)
- shell_pid=$(echo -e ${shell_pid} | tr -d '[[:space:]]');
- # this is the npm who runs shell
- npm_pid=$(ps -p ${shell_pid} -o ppid=;)
- npm_pid=$(echo -e ${npm_pid} | tr -d '[[:space:]]');
- # test whether npm tmp configuration is set
- # if not, assume the default /tmp
- if [ -z ${npm_config_tmp} ]; then
- npm_config_tmp=/tmp
- fi;
- echo "Removing ${npm_config_tmp}/npm-${npm_pid}*";
- rm -rf "${npm_config_tmp}"/npm-${npm_pid}*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement