Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash split array into chunks

#!/bin/bash

array=(aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm)
g=4

for((i=0; i < ${#array[@]}; i+=g))
do
  part=( "${array[@]:i:g}" )
  echo "Elements in this group: ${part[*]}"
done
Comment

PREVIOUS NEXT
Code Example
Shell :: windows git ssh key add 
Shell :: wp cli plugin install 
Shell :: List all installed programs or desktop application 
Shell :: how to disable browser autofill in Autocomplete mui component 
Shell :: laptop slow performance linux ubuntu 
Shell :: add changes from different branch 
Shell :: powershell allow execution 
Shell :: git show unpushed commits 
Shell :: install php freebsd 
Shell :: ssh login 
Shell :: how to terminate localhost 3000 linux 
Shell :: list node running 
Shell :: remove all files in a directory linux that match pattern 
Shell :: docker start container 
Shell :: gulp install 
Shell :: github how to remove changes 
Shell :: install vault 
Shell :: how to remove spaces at end of line linux 
Shell :: check port running 
Shell :: how to change the directory in git bash 
Shell :: find ip curl 
Shell :: bash for loop 
Shell :: gnome shell extensions 
Shell :: bash arrays 
Shell :: react day picker 
Shell :: openni 2 ros package install 
Shell :: Comandos Útiles Docker 
Shell :: nginx create alias 
Shell :: list files in cmd 
Shell :: git tag 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =