Reputation: 19456
I've got the following line in my script:
xrandr --newmode "$xx$y" $m
where $x
and $y
are integers, to produce an output like 1024x768
.
Unfortunately my script is interpreting the $x
as $xx
- how can I stop this & get the desired behavior?
Upvotes: 1
Views: 53
Reputation: 22428
The general logic is to isolate the variable so that it doesn't take xx
as the variable name. There are several ways to do that:
Using quotes:
x="xvar";y="yvar"
echo ""$x"x$y"
echo ""$x"x"$y""
echo "$x""x""$y"
echo "$x"x"$y"
Using brace (mentioned by Alberto Zaccagni):
echo "${x}x$y"
Upvotes: 1
Reputation: 31560
You could try to do it this way
"${x}x$y"
Have a look at the docs for more info.
Upvotes: 5