Bug 7052

Summary: Setting a variable to the result of a script does not run the script
Product: Busybox Reporter: Sean Walton <swalton>
Component: Standard ComplianceAssignee: unassigned
Status: NEW ---    
Severity: major CC: busybox-cvs
Priority: P5    
Version: 1.20.x   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:

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?