3

I have string save as

test="test1 test2
test3 test4
test5 test6"

and

echo $(shuf -e $test)

it gives me the same output as $test, why? I expect the different order of the original string

Tiger
  • 347
  • 2
  • 4
  • 12

1 Answers1

3

Hm.

$ test="test1 test2
> test3 test4
> test5 test6"
$ echo $test
test1 test2 test3 test4 test5 test6
$ echo $(shuf -e $test)
test4 test5 test2 test6 test1 test3
$ echo $(shuf -e $test)
test5 test2 test4 test3 test6 test1

Maybe by chance it just happened that the "randomly" chosen permutation for you was the identity permutation? Did you try several times?

dirkt
  • 31,679
  • 3
  • 40
  • 73