Manipulating Array: Adding an
Element – Start and Specific Position
• To add element at the beginning of array
• Place the new elements before the existing array
Unix=('Debian' 'Red hat' 'Ubuntu' 'Suse' 'Fedora' 'UTS' 'OpenLinux');
Unix=("Mint" "Solaris" "${Unix[@]}" )
• To add element at a specific index position. E.g., index 2
• Get all elements before index position2 Unix[0] and Unix[1];
• Add an element to the array;
• Get all elements from index position2 to the last Unix[2], Unix[3], ....
Unix=( "${Unix[@]:0:2}" "new_element" "${Unix[@]:2}" )