Skip to main content

All Questions

0 votes
2 answers
7k views

How to store and print variables with special characters in shell/bash/sh/

I basically need to load, save and reload multiple times and in different forms a variable that contains arguments for a program. The problem is that this variable can't be treated as a usual variable ...
4 votes
1 answer
327 views

How to explicitly set the tabname of a new gnome-terminal?

I want to explicity rename a tab in gnome-terminal on startup of the tab. I don't want to use gnome-terminal --title flag as that gets reset by my systems bashrc file after whatever else is supposed ...
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
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
1 answer
3k views

Is it safe to export a variable containing a password, then resetting it?

My script needs to call multiple times a program that needs a password, which can only be passed as an environment variable. As I want to ask the user for the password only once, I've done this : ...
-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=&...
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 ...
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 ...

15 30 50 per page
1
2 3 4 5