Skip to main content

Questions tagged [environment-variables]

For questions pertaining to environment variables, a set of dynamic variables that can affect the running processes behavior and access to resources. Use this tag for questions about environment variables or questions about issues arising from the impact of setting or modifying the variables value in running processes behavior and access to resources.

0 votes
0 answers
48 views

How should one choose whether to utilise ~ or $HOME? [duplicate]

Context When utilising the IEEE Standard 1003.1-2017 Shell Command Language, I frequently want to reference the value which $HOME contains. However, two methods of dynamically acquiring the path are ...
RokeJulianLockhart's user avatar
-1 votes
2 answers
105 views

How to check if env exist in bash?

What is the standard way, in bash, to check if an environment variable is set up? I'm a little confused between the following options: ! [ -z "${VAR}" ] [ -n "${VAR}" ] [ "${...
kj-crypto's user avatar
  • 109
2 votes
1 answer
332 views

how to pass environment variables to singularity exec

I have a BASH pipeline which at a point runs a Singularity container with singularity exec as follows: singularity exec --bind `pwd`:/folder --bind $d:/results <image>.sif <tool_command> -...
Matteo's user avatar
  • 199
5 votes
1 answer
808 views

My bash script keeps telling me my directory doesn't exist even though it does [duplicate]

I have a script and when I run it, it returns Directory not found: ~/Pictures/Wallpaper The script is as follows: #!/bin/bash # Check if the wallpaper directory exists if [ ! -d "$WALLPAPER_DIR&...
PrismaPixel Studios's user avatar
0 votes
0 answers
39 views

How many environments are stored in the stack? [duplicate]

When I used the getenv() function to get the address of USER, I got 0x7ffceae5e923 but when randomly checking the address using gdb, the $USER variable was stored at 0x7ffffffffe90e [ I started a ...
KeShAw's user avatar
  • 13
2 votes
1 answer
894 views

What do programs use to read their environment?

I'm on Fedora, where all preinstalled shells apparently support bashisms: bash --posix does, and even sh. Still, when I used this function, pathprepend () { if [[ ":$PATH:" != *":$1:...
Arch Stanton's user avatar
0 votes
1 answer
48 views

best way to load an .env file as exported variables

I find .env files to be funny things, is there a one line utility to do this: set -o allexport source .env set +o allexport I do not like flipping the shell settings like that, wouldn't it be nice if ...
Alexander Mills's user avatar
0 votes
2 answers
43 views

how do I setup VULKAN_SDK environment variables in Debian/Raspberry Pi Os

First things first; I am new to Linux and I don't understand a lot of things. I'm working on a Raspberry Pi OS which is Debian based. There is a file with environment variables: "setup-env.sh&...
Desert Wind's user avatar
1 vote
1 answer
57 views

Bad environment variables messed up booting on Debian bassed (Raspberry Pi OS)

I set the wrong path in some environment variables, and now booting gives a whole new taste. The OS is Raspberry Pi OS, which is Debian based. RESULT: Right after booting, I get a black screen with a ...
Desert Wind's user avatar
0 votes
0 answers
32 views

How is `flatpak override --env=FOO=bar some.app.id` suppose to work?

I thought that I could: Use override to set an env for some flatpak And then every time I run this app If I enter in the process (to be sure, I did this for all 3 types of pids: instance,pid,child-...
Timo's user avatar
  • 673
5 votes
1 answer
419 views

Weird shell variable expansion in bash

The bash manual says "The environment for any simple command or function may be augmented temporarily by prefixing it with parameter assignments". I also understand that exported variables ...
carce-bo's user avatar
  • 197
0 votes
1 answer
75 views

how can I run a crontab with a particular user's full environment variables?

Hello can you please help? I am running a script in WSL that requires the auto loaded host variables to be present when the crontab runs it runs when I am at the user log in however not when I am ...
Jonathan Lee's user avatar
3 votes
2 answers
221 views

How to handle a missing environment variable set in `crontab`

I have a bash script that I need to be able to start from either: cron an interactive (logon) shell This script needs to know whether it was started from cron, or started from an interactive shell. ...
Seamus's user avatar
  • 3,727
0 votes
1 answer
82 views

With sudo, why are inline environment variables not read correctly without -E on some systems?

I have a bash script which logs into my bitwarden instance using the bw cli, in the following way: test.sh: #!/usr/bin/sh set -e -o pipefail bw logout --quiet || true BW_CLIENTID=$(cat ./credentials....
Christian Eriksson's user avatar
0 votes
2 answers
61 views

Using Bash, mysteriously don't need "export" command

I'm using Cygwin to get Linux functionality on Windows 11. Specifically, I am using Cygwin's xpdf to browse PDFs. It can open a hyperlinked URL if $BROWSER is set. Mysteriously, I found that I don'...
user2153235's user avatar

15 30 50 per page
1
2 3 4 5
104