Guy*_*rom 9 launcher bashrc .desktop
我使用的是 IntelliJ IDEA,它使用了 .bashrc 脚本中定义的一些环境变量。
如果我从终端运行它的 shell 脚本一切正常,但是如果我创建一个 .desktop 文件来从启动器运行它,那么它会在没有 .bashrc 环境的情况下加载。
我还尝试使用“使用终端运行”选项,但没有帮助。有没有办法做这些事情?
桌面文件的内容:
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA
Icon=/home/gmarom/bin/idea-IU-135.1230/bin/idea.png
Exec="/home/gmarom/bin/idea-IU-135.1230/bin/idea.sh" %f
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea
Run Code Online (Sandbox Code Playgroud)
将环境变量移动到.profile对我不起作用。相反,我删除了@oliman 从我的建议中删除的代码,.bashrc然后我更改了我的 IntelliJ IDEA 的启动器:
"/opt/idea-IU-163.12024.16/bin/idea.sh" %f
Run Code Online (Sandbox Code Playgroud)
对此:
bash -c "source ~/.bashrc && /opt/idea-IU-163.12024.16/bin/idea.sh %f"
Run Code Online (Sandbox Code Playgroud)
当从启动器运行时,idea.sh 脚本使用非迭代 shell 启动。在您.bashrc确保之前导出环境变量
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
Run Code Online (Sandbox Code Playgroud)
或者将环境变量导出放在 ~/.bash_profile
| 归档时间: |
|
| 查看次数: |
5822 次 |
| 最近记录: |