Questions tagged [eval]
The eval tag has no summary.
81 questions
5 votes
2 answers
438 views
How to do indirect variable substitution in a GNU Makefile?
In the shell I can do $ a=b b=c; eval echo \$$a c How do I do the same with GNU Make's $(eval) function? $ cat Makefile a=b b=c x:; echo {What goes here in order to get:} $ make c
0 votes
1 answer
158 views
How to properly make eval safe?
I'm writing a shell script that changes its behavior based on the number of positional parameters passed script.sh if [ $# -eq 1 ]; then if [ -f "$1" ]; then validate='validate <&...
1 vote
0 answers
19 views
While Loop Exits After Calling Function [duplicate]
I'm trying to do a db backup script using Bash. When adding a "Resume" feature to the script, I do the following loop calling defined functions to do step by step (depending on the .lock ...
0 votes
2 answers
684 views
eval: $? vs ${PIPESTATUS[@]} (bash)
In bash 5.0, I wish to capture the ${PIPESTATUS[@]} of a piped command that is executed via eval. However, eval appears to mask ${PIPESTATUS[@]}, but doesn't mask $? which is the equivalent to ${...
0 votes
1 answer
86 views
Shell script: Using variables makes command fails ( substituting values of variables manually ; command works fine )
In a bash script: jenkins_folder=`cut -d "|" -f1 -s input.csv` jenkins_url='https://url.com:8181/jenkins/view/' echo "jenkins_folder : ${jenkins_folder}" for job in ...
1 vote
1 answer
1k views
Command output evaluation not working in Bash script [duplicate]
I am trying to automate adding Homebrew to my path in a shell script, but these two lines do not evaluate inside my shell script: #!/bin/sh eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)&...
0 votes
1 answer
409 views
Declare variable in eval Bash
There is a way to declare variable in eval ? For example function test { eval $1 } test " value="foo" echo "$value" " But it display nothing. ...
0 votes
2 answers
469 views
Bash: how to wrap a command to measure its elapsed time?
How to wrap a command to measure its elapsed time? Currently I do it using eval: do_cmd_named() { local name=$1 local cmd=$2 echo "$name" local start_time=$(date +%s) eval "$...