All Questions
Tagged with environment-variables shell-script
156 questions
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 ...
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&...
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:...
2
votes
2
answers
342
views
commands execution based on file size fails with no apparent issues
I was working on an array job for a small pipeline, and I happened to need a way to execute a specific command based on file size. I found this post and similar which describe how to do it. At the ...
0
votes
0
answers
59
views
Concatenating 2 environmental variables in a ksh script [duplicate]
I have a storage.src file with the following 2 environmental variables exported
export FIRST="HelloHelloHello"
export SECOND="World"
I have a .sh file as follows
#!/bin/ksh
. /...
0
votes
0
answers
116
views
Bash script or the like to erase env values that host secrets once used to initialized app in a kubernetes container
I have a flask app that runs in a kube cluster. It does all the right things by using kube secrets to set the env values required to initialize the application. There are some env values I suspect ...
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
1
answer
734
views
execute script from another script not working [closed]
I am using shell scripts to compile the different components. I have one main script which is calling another shell script.
Here is an example,
Repo/build.sh
Repo/code/mode/1/build/build_1.sh
Now if ...
0
votes
1
answer
146
views
How might I source a Bash script from another interactive Bash script?
I have a interactive Bash script, conozcoArrays.sh,
#!/usr/bin/bash
echo -e "\nGive me their phone number?\n"
read number
TOGOes=("$(find ~/chicas -maxdepth 1 -iname "*$number*&...
-3
votes
2
answers
1k
views
Bash Script - Expand ESCAPED dollar-sign ($) into its Variable
My Problem
I have this run.sh script:
#!/bin/bash
TODAY=$(date)
FILE="my_file.txt.\${TODAY}"
When I echo FILE I get this:
echo ${FILE}
Output: `my_file.txt.${TODAY}`
But I want this:
echo $...
0
votes
0
answers
254
views
Script for awscli check not working with crontab schedule
I have written a small code snippet to check the aws cli version
#!/usr/bin/env bash
if [ -e "/usr/local/bin/aws" ];
then
myAWS="/usr/local/bin/aws"
else
...
1
vote
0
answers
32
views
What is the name of this ENV definition ${HOME:-/home}? [duplicate]
I am creating a shell script to deploy a container, and found in some docker files this definition of ENV: ${HOME:-/home}. I want to know what is the name of this kind of definition and where can I ...
0
votes
1
answer
1k
views
How to correctly add variable to environment or session
I work with a opensource software that I have built locally. After build the manual says to run it like this while inside the build directory
$ LD_LIBRARY_PATH=../applicationExeFile
Then the ...
0
votes
1
answer
108
views
Save every output of same command in different variables
#!/bin/bash
SERVERLABEL=( 11011-22022 33033-44044-10101 55055-10001-20002 )
for vmlabel in "${SERVERLABEL[@]}"
do
linode-cli linodes list | grep $vmlabel | grep -E -o &...
0
votes
0
answers
20
views
Is it possible to export env vars to current shell, from within a child process/script [duplicate]
Is it possible to export env vars to the current shell, from within a child process/script that was executed from the current shell?
Take this ultra-simplified example script:
#!/bin/bash
export FOO=&...