All Questions
Tagged with environment-variables scripting
32 questions
2
votes
2
answers
63
views
How to source environment variable in command line with && combiner?
For a NodeJs app, I wrote the following script to deploy the app:
"scripts": {
"deploy": "source private/create_env.sh && ./deploy.sh",
}
private/create_env.sh ...
0
votes
1
answer
248
views
Is it a good idea to put "export BASH_ENV=~/.bashrc" in my .bashrc?
Let's say my Bash has some extensive ~/.bashrc customization that aids me not only in interactive use, but also in scripting (aliases, functions, variables, etc.). I would like to have this available ...
0
votes
0
answers
55
views
Source env variable resolved instead of local env variable
I am having the following issue with Enviroment variables:
In my linux server I have an enviroment variable HOSTNAME (has value SERVER_HOSTNAME)
In my Linux box I have another enviroment variable ...
1
vote
1
answer
635
views
Why not prepend user directory to PATH?
For user scripts, the usual advice is to append their directory to $PATH in one's .profile:
PATH="$PATH:$HOME/.myscripts" # or .bin or whatever
Apparently that is safer than prepending it: ...
1
vote
1
answer
7k
views
Run a Bash Script from Python and import the exported environment variables into Python
I have the following Bash script called Test_Vars.sh
#!/bin/bash
#----------------------------------------------------#
# Environment Variables being used in the process #
#------------------------...
0
votes
1
answer
661
views
sudo crontab notify-send doesn't work
I have read similar posts here, here, here and here that mentioned some environment variables DISPLAY and DBUS_SESSION_BUS_ADDRESS. Setting them at the top of my user crontab enabled notify-send to ...
0
votes
0
answers
3k
views
Get environment variable from python script
I have bash script config.sh in which several variables are exported , and I need those variable in my python script.
config.sh
export VAR="YES"
My approach is to source the config.sh from the ...
1
vote
1
answer
1k
views
Script to compare 2 .env files then overwrite values on the default one base on another
I have 2 env files. One is the default one .env and another one is .env.overwrite.
I want to have a script file that when I run and specify the arguments, for examples:
./rebuild_env .env .env....
-1
votes
2
answers
142
views
Is this allowed in an `if statement`? [closed]
# optional cropping
if [ "$1" == "cropit" ]; then
ITS_CROP_TIME=
mkdir cropped; for i in *.mp4; do ffmpeg -i "$i" -filter:v "crop=1920:980:0:-100" cropped/"${i%.*}.mp4"
rm -r *.mp4
cd ...
1
vote
1
answer
345
views
Writing logs for OpenVPN in Ubuntu18
I've installed OpenVPN on Ubuntu18, and it works. I'd like to have a log containing only the times when users connect and disconnect. Found a hint how to do it at [https://github.com/furlongm/openvpn-...
3
votes
6
answers
5k
views
shebang or not shebang
I want to use a program in the shebang, so I create a script named <myscript> with:
#!<mypgm>
I also want to be able to run <mypgm> directly from the command prompt.
<mypgm> ...
2
votes
2
answers
11k
views
Bash environment variables in non interactive mode
I'm trying to define environment variable for non-interactive console in Raspbian.
In theory I need to add the varaibles to ~/.bashrc or ~/.profile or /etc/bash.bashrc or /etc/profile. For example I ...
5
votes
1
answer
4k
views
How do I properly change the debian default python 2.7.9 to python3 or another version? [duplicate]
what is best-practice for changing the default global python interpreter on my fresh debian-based linux node to python3.x?
When I create a fresh Debian or Ubuntu VM, one of the first things I do is ...
42
votes
3
answers
207k
views
import environment variables in a bash script
I set some environment variables in a terminal, and then run my script. How can I pull in the variables in the script? I need to know their values. Simply referring to them as $MY_VAR1 doesn't work; ...
108
votes
8
answers
54k
views
Multiple arguments in shebang
I am wondering whether there is a general way of passing multiple options to an executable via the shebang line (#!).
I use NixOS, and the first part of the shebang in any script I write is usually /...