今天跑brew link node 的时候,报有些目录没有写权限。自己赋了几个目录,还是一直在报。没办法,只能写个脚本赋权,虽然效果很烂,但是it works(狗头.jpg)
succ=0;
while [[ $succ == 0 ]]; do
res=$(brew link node 2>&1)
fail_msg=$(echo $res | grep 'is not writable')
if [[ $fail_msg != "" ]]; then
succ=0
d=${fail_msg}
d=${d/is not writable/}
d=${d/Error: Could not symlink ([\w\/\.\-])+/}
sudo chmod g+rw $d
sudo chmod o+rw $d
else
succ=1
fi
done
网友评论