println "signfile:"+System.getenv("PS1")
properties.load(project.rootProject.file(System.getenv("qssqsignfile")).newDataInputStream())
发现无论是系统的还是 用户目录下的环境变量~/.bash_profile
的都获取为null,下面
https://blog.csdn.net/zhzdeng/article/details/64921967
curl https://raw.githubusercontent.com/ersiner/osx-env-sync/master/osx-env-sync-now -o ~/bin/osx-env-sync-now
如果~/bin
目录不存在,则mkdir
创建一个便是,或者使用系统的bin文件夹也行。
给脚本权限
chmod +x ~/bin/osx-env-sync-now
1
在需要重新加载脚本的时候执行命令
osx-env-sync-now
但是我发现我这里是不生效的。
那么改成这样吧
curl https://raw.githubusercontent.com/ersiner/osx-env-sync/master/osx-env-sync-now -o /bin/osx-env-sync-now
osx-env-sync-now
发现不行的.
aaadeMBP:bin aaa$ curl https://raw.githubusercontent.com/ersiner/osx-env-sync/master/osx-env-sync-now -o /usr/local/bin/osx-env-sync-now
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 283 100 283 0 0 185 0 0:00:01 0:00:01 --:--:-- 185
aaadeMBP:bin aaa$ osx-env-sync-now
-bash: /usr/local/bin/osx-env-sync-now: Permission denied
aaadeMBP:bin aaa$ chmod +o osx-env-sync-now
chmod: osx-env-sync-now: No such file or directory
aaadeMBP:bin aaa$ chmod +o /usr/local/bin/osx-env-sync-now
aaadeMBP:bin aaa$ osx-env-sync-now
-bash: /usr/local/bin/osx-env-sync-now: Permission denied
aaadeMBP:bin aaa$ chmod 777 /usr/local/bin/osx-env-sync-now
aaadeMBP:bin aaa$ osx-env-sync-now
/Users/aaa/Library/LaunchAgents/osx-env-sync.plist: No such file or directory
/Users/aaa/Library/LaunchAgents/osx-env-sync.plist: No such file or directory
Environment variables reloaded. Now relaunch your GUI apps to make them aware.
For command line apps, launch a new Terminal session.
aaadeMBP:bin aaa$
ok
curl https://raw.githubusercontent.com/ersiner/osx-env-sync/master/osx-env-sync-now -o /usr/local/bin/qssq-env-sync
然后chmod /usr/local/bin/qssq-env-sync
然后 chmod qssq-env-sync
唉。
最后这篇文章更靠谱s
也就是编辑/etc/profile
环境变量文件,首先要sudo chmod 777 /etc/profile
让自己可以修改文件,然后 vim /etc/profile
signfile=/Users/aaa/Documents/qssq.keysotre
qssqsignfile=/Users/aaa/Documents/qssq.keysotre
launchctl setenv signfile $signfile
launchctl setenv signfile $qssqsignfile
然后重启
https://blog.csdn.net/alan_alei/article/details/73360484
https://blog.csdn.net/a11101171/article/details/49154535
最后发现还是不行,好吧,还是每次重启电脑手动启动批处理
各位知道mac电脑能有效设置自启动的留言下,反正上面的命令启动似乎没效果,我也不知道如何查询到底是啥导致没效果。
#!/bin/bash
qssq-env-sync
echo 环境变量已经设置完成
2018-05-13 09:40:40
手痒百度了一下添加自启动。
我的方法是给批处理脚本可执行权限,然后添加这个批处理自启动,这样不需要每次电脑开机启动就要手动执行一次命令了。