Array of 4 10s with perl, bash

perl

drbean@ESPRIMO ~/dot
$ perl -e "@X=(10)x4; $,= ; print @X"
10 10 10 10

bash

drbean@ESPRIMO ~/dot
$ x=($(printf "10 %.0s" {0..3}))

drbean@ESPRIMO ~/dot
$ echo ${x[*]}
10 10 10 10

perl is the winner!

A nicer bash way is

drbean@ESPRIMO ~/dot
$ x=($(yes 10 | head -n 4 | tr '\n' ' '))
Me at

Back to AssigningSameValuedPerlBashArrays