在IntelliJ IDEA Bash脚本中使用环境变量 [英] Use Environment Variables in IntelliJ IDEA Bash Script

查看:281
本文介绍了在IntelliJ IDEA Bash脚本中使用环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:通过构建调用bash脚本的runConfiguration来运行bash脚本作为构建/运行的方法.

Goal: to run a bash script as the method for builds/runs, by building a runConfiguration that calls the bash script.

我正在使用最新版本的IntelliJ IDEA中的BashSupport插件.我试图从从runConfiguration调用的shell脚本中引用系统环境变量,但是除非我在runConfiguration的XML中手动指定环境变量,否则就不能提取系统环境变量,这不是一个选择.我希望能够直接从系统中提取变量.我尝试将环境变量放在/etc/environment和.bashrc和.zshrc中.

I'm using the BashSupport plugin in the latest version of IntelliJ IDEA. I am trying to reference system environment variables from a shell script that is called from a runConfiguration, but I can't pull in system environment variables, unless I manually specify the environment variables in the runConfiguration's XML, which is not an option. I want to be able to pull variables directly from the system. I have tried putting environment variables in /etc/environment and .bashrc and .zshrc.

任何建议将不胜感激!

操作系统:基于Ubuntu

OS: Ubuntu-based

推荐答案

谢谢@CrazyCoder!绝对是这样.事实证明,在系统重新启动(不仅是IntelliJ重新启动)之后,IntelliJ能够提取我放入/etc/environment的变量.甚至不需要将它们添加到~/.profile.感谢您的研究!

Thank you @CrazyCoder! That was definitely it. Turns out that after a system restart (not just an IntelliJ restart), IntelliJ was able to pick up the variables I put in /etc/environment. Didn't even need to add them to ~/.profile. Thanks for doing the research!

这篇关于在IntelliJ IDEA Bash脚本中使用环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆