I'm having trouble saving an asterisk to a variable within a Bash script. The inputs I use are -1 and 1.
#!/bin/bash
function aleatorio {
printf "((%d %% 1000) / 1000,0) * (%f - %f) + %f\n" $RANDOM $2 $1 $1
}
X=`aleatorio -1 1`
echo $X
When I print the variable $X
, that asterisk is replaced by all the elements of the current route. I've also tried single quotes.
The output I get when running the program is:
((12210 % 1000) / 1000,0) CarloMagno.sh Downloads Documents git.txt Images Practice_03_AC Practice_03_IA Practice_04_FIS Programming ProgramasPortables Test.sh scriptVectorNUltraDimensional.sh TasksPending.txt University (1,000000 - -1,000000) + -1,000000
Those are the elements that are in the folder where I execute the Script. That happens both using double quotes, and single quotes, like \*