Linux tips and tricks
Saturday, May 3, 2014
Bash - Join Arrays
How to join arrays in Bash Script? Very simple :) Example:
#!/bin/bash
a1=(a b c d) #array 1
a2=(e f g h) #array 2
a=(${a1[@]} ${a2[@]}) #join array
echo ${a[@]}
Output is:
a b c d e f g h
Make array of arrays and result is joined array :)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment