Questions tagged [variable-substitution]

The tag has no usage guidance.

10 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
85 views

Correct treatment of quotes in parameter expansions

Using the default value of IFS, consider unset var set -- ${var:-"hello"} echo "$#" This prints 1 as the parameter expansion expands to the single string hello. unset var set -- "${var:-"hello"}" ...
3
votes
1answer
933 views

error: Macro % has illegal name (%define)

I have a build support script for building my packages. Now I want to automatically set the Version in my spec files. I use the macro %{auto_version} for that. In my script I want to invoke rpmbuild -...
3
votes
1answer
356 views

Does tcsh have an equivalent for “${a:-b}” for default variable assignment like Bash?

I want to do this in one line because I want to use it in my aliases. Can I do this similarly in tcsh ? Using “${a:-b}” for variable assignment in scripts There are some ways of doing it here but ...
2
votes
0answers
76 views

What are the contexts where Bash doesn't perform word splitting and globbing?

Bash doesn't perform word splitting in globbing in these cases: LHS or RHS of an assignment, except for indexed arrays var=$value # simple variable declare -A hash key=...
2
votes
0answers
511 views

Running R script and global variable overriding with <<- from cron

I have a R script that works just fine when I run it from RStudio. However, once I schedule it through cron under user RStudio only with home directory (/home/rstudio), it halts at the very step I ...
1
vote
0answers
140 views

Bash variable value partially substituted in Curl input

Below is my shell script in which I'm trying to use the value of a variable as input to curl. However, the script is giving an error and when trying to debug the script, I can see that the value of ...
1
vote
0answers
41 views

To divide a a loop variable per se and save in another one to be used later

I am facing a problem with bash script: I have a set of variables 'i' that ranges from 3.31 up to 3.35. My script prints out, as a function of the variable 'i' some input file for geometrical ...
1
vote
1answer
563 views

Replace command in Bash script from another script

I'm trying to setup a script that will fetch changes from github where a script has a command that's not executable in Mac OS X. What I'm aiming for is to use sed etc to replace the command within ...
1
vote
0answers
2k views

bash - expect and variables

I have the followin: while read line; do userinfo=$(echo $line | sed 's/@/,/') IFS=',' read -a address <<< "$userinfo" userid="${address[0]}" domain="${address[1]}" fname=...
0
votes
0answers
95 views

How to resolve a variable's value inside an array in bash

I have a few files whose names I have assigned into variables. (There may be n number of files). Those variables are passed into an array. Now I want to print the names of the original files using ...