Skip to main content

All Questions

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 ...
Matteo's user avatar
  • 199
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 ...
Sebastian Carlos's user avatar
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 ...
sagar's user avatar
  • 3
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*&...
John Smith's user avatar
-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 $...
Bog's user avatar
  • 1,124
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 ...
AashkaTe's user avatar
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 ...
Walddys E. Dorrejo Céspedes's user avatar
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 ...
DEKKER's user avatar
  • 998
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 &...
ph3ro's user avatar
  • 378
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=&...
Rino Bino's user avatar
  • 121
1 vote
1 answer
961 views

Teeing each output while capturing return exit code (are any env variable) and passing it back "up the chain"

I've been struggling and reading quite a bit about this, and clearly bash is probably not the best tool for this, but since I'm already dug this deep into this hole (too much of the code is already ...
Lockszmith's user avatar
0 votes
1 answer
1k views

Using `env` command with `eval`

Suppose I have this in script.sh: env -i SOMEVAR=SOMEVALUE eval -- "$@" I run it with: ./script.sh echo "\$SOMEVAR" Now it shows: env: ‘eval’: No such file or directory I ...
sudoer's user avatar
  • 65
0 votes
0 answers
1k views

shared library not found even if "export LD_LIBRARY_PATH" is set

Here comes a strange question. I have a QT App and it requires some libraries. Normally, the following bash script works: #!/bin/bash export LD_LIBRARY_PATH="./libs" export QT_DEBUG_PLUGINS=...
Freedomrunner's user avatar
1 vote
1 answer
894 views

Why does $HOME not expand the HOME variable here?

I wrote a simple script. read -p "Enter the path: " path echo "$path" I give the input as $HOME And the output is: $HOME And if I write echo "$HOME" outputs /home/sam ...
klaus_03's user avatar
2 votes
1 answer
4k views

Environment variable expansion inside $(command substitution)

I'm running Bash 5.1.4 on Debian. I'm writing a post-installation script to copy configuration and other files to locations in my home directory. I add the intended destination to each file at the ...
mathbekunkus's user avatar

15 30 50 per page
1
2 3 4 5