Bug 7052 - Setting a variable to the result of a script does not run the script
Summary: Setting a variable to the result of a script does not run the script
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.20.x
Hardware: Other Linux
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-21 14:25 UTC by Sean Walton
Modified: 2014-04-22 12:38 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sean Walton 2014-04-21 14:25:10 UTC
Code:

export RAND_SEED=123456789
export RANDOM=${RAND_SEED}
randomize() {
        RANDOM=$(( ${RANDOM} * ${RAND_SEED} % 4000000000 ))
echo "**************${RANDOM}" >2
        echo ${RANDOM}
}

If I run this by hand I get "unique" results, but if I

x=$(randomize)

'randomize' is executed at most one time. Every subsequent call yields the previously derived value.

Is this normal 'ash' behavior?

This is being run on an i.MX6 ARM processor with a home-brew Linux distro.
Comment 1 Denys Vlasenko 2014-04-22 12:38:21 UTC
Failed to reproduce it.
Which version of busybox do you have?