Ok so my problem is as followed, I wish to pass this :-
echo $(($(date +%s%N)/1000000))
Into a variable "a" to it can be added to an array, something like this :-
The reason I am doing this is a would like 4 random digits to play with (Random numbers). I have produced this bash script to show an example.
#!/bin/bash for (( c=0; c<=10; c++)) do echo $(($(date +%s%N)/1000000)) sleep .5 done
Which outputs :- (Ignore the first 9 digits)
1622001937610 1622001938249 1622001938758 1622001939267 1622001939774 1622001940282 1622001940790 1622001941299 1622001941807 1622001942315 1622001942823
Now I wanted to add the results of just one instance of this into an array, index from the last 9th digit to receive 4 random digits based on nano second time.
How ever I don't seem to have full grasped the syntax used within bash to achieve the result.
Could I possible call
date +%s%N)/1000000 straight into an array? As my idea was to create and empty array and then just append the result into the array, and index from the 9th number. And pass the result into a second variable from there I can work on.
Just learning to turn the result of
date +%s%N)/1000000 into a variable would be of great help.
Sorry to be a pain. Any thank you in advanced.