environment-variables

Which scripts modify the path envirorment variable?

Which scripts modify the path envirorment variable? Which scripts modify the path environment variable? What methods can I use to determine which scripts modify the path environment variable? Asked By: Lead Vaxeral || Source Just grep for "PATH" on the script of interest. Normal bash additions to PATH occur in .profile. Project specific modifications can …

Total answers: 2

Environment variable LOGNAME or USER does not correspond to effective user id

Environment variable LOGNAME or USER does not correspond to effective user id I’m running an Ubuntu 20.04.6 LTS server. The server hosts some Virtualbox virtual machines that I backup with a bash script on a daily basis. That works quite fine. The bash script also sends some emails when the backup worked, or I get …

Total answers: 1

Concatenate string after grabbing environment variable

Concatenate string after grabbing environment variable I’m trying to concatenate a string with a variable which is in .env file. My .env is this: API_URL=http://localhost:3030 NODE_ENV=development And here is my code: [ ! -f .env ] || export $(grep -v ‘^#’ .env | xargs) URL="${API_URL}/health" echo $URL I expect this to print http://localhost:3030/health. But it …

Total answers: 2

Why is FPATH not listed in `env` output?

Why is FPATH not listed in `env` output? I’m running zsh (on MacOS) and I just learned about $fpath. As usual, I then typed env to check it participating in my environment but to my surprise it was not there! Yet, $FPATH (and $fpath) is defined: % echo $fpath /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.9/functions % echo $FPATH …

Total answers: 1

How to source environment variable in command line with && combiner?

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 creates environment variables that are used in the deploy.sh script. export USERNAME=alphonsio export SERVER=ftp.example.com export … The && combiner prevent the environment …

Total answers: 2

LINENO and BASH_LINENO

LINENO and BASH_LINENO So I’m not sure why this is.. I know ${LINENO} normally contains the line in the script, and BASH_LINENO goes based on input from BASH_SOURCE as an array $ (echo hi;declare -p LINENO BASH_LINENO;echo -e "My LINENOtist${LINENO}nMy BASH_LINENOtist${BASH_LINENO[@]}") hi declare — LINENO="34" declare -a BASH_LINENO=() My LINENO is 34 My BASH_LINENO is …

Total answers: 1

non-login shell sources $HOME/[.local/]bin to $PATH and I can't find why

non-login shell sources $HOME/[.local/]bin to $PATH and I can't find why OS: Ubuntu Desktop 22.04 I am initially logged in as user carl. I open a shell and echo $0, I get the confirmation that I am in a non-login shell. ("bash", no dash) But when I then echo $PATH I see that $HOME/.local/bin and …

Total answers: 1

How do I use environment variables from file in systemd

How do I use environment variables from file in systemd I set environment variables in some file /etc/profile.d/mercure.sh like this : export MERCURE_PUBLISHER_JWT_KEY=$(cat /home/stephane/mercure/publisher.key.pub) export MERCURE_PUBLISHER_JWT_ALG=RS256 export MERCURE_SUBSCRIBER_JWT_KEY=$(cat /home/stephane/mercure/subscriber.key.pub) export MERCURE_PUBLISHER_JWT_ALG=RS256 export SERVER_NAME=localhost:3000 I need them for running following command (for mercure hub): MERCURE_PUBLISHER_JWT_KEY=$MERCURE_PUBLISHER_JWT_KEY MERCURE_SUBSCRIBER_JWT_KEY=$MERCURE_SUBSCRIBER_JWT_KEY SERVER_NAME=$SERVER_NAME /usr/bin/mercure run I want to create a mercure.service file …

Total answers: 2

bash var substitution inside json to use in curl

bash var substitution inside json to use in curl Team, I am unable to substitute values inside json(myjson) to use in curl command. any hint? JENKINS_USERNAME="svc-user" JENKINS_USER_TOKEN="xxxx" JENKINS_INSTANCE_FQDN="sham.blsm.comp.com" INSTANCE="test-verify" CREDENTIAL_ID_NAME="test" USERNAME_KEY="tests" USER_PASSWORD_KEY="testst" ID_DESCRIPTION="asdfasdfasdf" myjson=”{ "credentials": { "scope": "GLOBAL", "id": "’"${CREDENTIAL_ID_NAME}"’", "username": "’"${USERNAME_KEY}"’", "password": "’"${USER_PASSWORD_KEY}"’", "description": "’"${ID_DESCRIPTION}"’", "$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl" } }” curl -X POST https://${JENKINS_USERNAME}:${JENKINS_USER_TOKEN}@${JENKINS_INSTANCE_FQDN}/${JENKINS_INSTANCE}/credentials/store/system/domain/_/createCredentials –data-urlencode …

Total answers: 2

Auto-completion puts back-slash before $ mark, how can I disable it? (ubuntu 22.04)

Auto-completion puts back-slash before $ mark, how can I disable it? (ubuntu 22.04) To access files in a directory from another directory, I often set a variable for that directory. For example (so you can try it your self), export dir1=/usr/local/bin and then type ls $dir1/ followed by tab. I wanted the shell to show …

Total answers: 1

Set PATH for /bin/sh in Debian:11 image

Set PATH for /bin/sh in Debian:11 image Background I am building an image based on Debian:11. I am trying to set the PATH for the /bin/sh with a dynamic value determined at image build-time. (The "at image build time" is important. I cannot simply include a static ENV PATH in my Dockerfile.) The Problem When …

Total answers: 1

Is it possible to use environment variable (e.g. $HOME ) in auditctl ? Ubuntu 20.04

Is it possible to use environment variable (e.g. $HOME ) in auditctl ? Ubuntu 20.04 I’m trying to monitor /home/<user>/ folder. I created # auditctl -w $HOME -p rwxa -k home_access rule. But it creates rule only for current user. Is it possible to create such a rule that monitors $HOME folder for all users? …

Total answers: 1

Which environment variable controls the location of .local directory?

Which environment variable controls the location of .local directory? Due to storage space constraints in my home directory, I need to move as much out of there as possible. I have moved caches and configs out by setting the $XDG_CACHE_HOME and $XDG_CONFIG_HOME directories. However, I cannot find the proper environment variable to set in order …

Total answers: 1

Add remote server path to environment variable

Add remote server path to environment variable A very (I thought) simple question, but cannot find an answer: In Bash: Is it possible to add the path to a remote server to an environment variable? Use case: We are setting up a local pip repo and want to set the rc file’s path as an …

Total answers: 1

some_variable vs some-variable in zsh

some_variable vs some-variable in zsh Why is it that zsh seems to understand what to do with some_variable=1 command, but not some-variable=1 command? E.g.: $ fs_screen=1 mpv –fs-screen=${fs_screen} someFile.mp4 works fine but $ fs-screen=1 mpv –fs-screen=${fs-screen} someFile.mp4 results in zsh: command not found: fs-screen=1 I went digging through the zsh documentation and found what I …

Total answers: 1

diffing two .env files

diffing two .env files I have two env files, let’s say x.env and y.env, the order of the variables is different, but the content could be the same but likely different. Is there some tool I could use to diff the variables? env -i ( # clear all envs source x.env; env | sort > …

Total answers: 1

Pain with Maven and Java env variables

Pain with Maven and Java env variables So I installed Java following this guide as I did many times, and set $JAVA_HOME in /etc/environment, java -version works fine. After that I’m following this guide as I did many times and install maven. I don’t understand why I need to add to .profile JAVA_HOME once again …

Total answers: 1

`sudo –preserve-env=MY_VAR` vs `sudo env MY_VAR=$MY_VAR`

`sudo –preserve-env=MY_VAR` vs `sudo env MY_VAR=$MY_VAR` I read in man sudo the following: –preserve-env Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an error if the user does not have permission to preserve the environment. But I wonder, even if I don’t have …

Total answers: 1