Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash adding to array

#!/bin/bash

#Making an array
array=(1 2 3)

#Appending the array
array+=(4)

#Printing the array
echo ${array[@]}
Comment

bash array append

for i in $(seq 2.5 .1 5);
do
    # Print the value
    echo $i " ########";
    arrVar+=($i) # appending 

done

# Iterate the loop to read and print each array element
for value in "${arrVar[@]}"
do
     echo $value
done

other ways : https://linuxhint.com/bash_append_array/


2.5
2.6
2.7
2.8
2.9
Comment

PREVIOUS NEXT
Code Example
Shell :: hdfs dfs add file 
Shell :: How to check the Redis version? 
Shell :: git source autocomplete 
Shell :: nvm how to install latest node 
Shell :: powershell show environment variables 
Shell :: check memory speed 
Shell :: WSL 2 requires an update to its kernel component. 
Shell :: How to Block apache Ports 
Shell :: git pasar de https a ssh 
Shell :: mv is a Unix command and I think you are using windows. You have 2 options: Installing Git bash and in the bash use mv command. Using Windows move command. 
Shell :: copy file using powershell script 
Shell :: find a file in all subdirectories in linux 
Shell :: linux saber la distribución terminal 
Shell :: tar file 
Shell :: untar tar.gz 
Shell :: visualize git tree branches in repo 
Shell :: delete node_modules 
Shell :: download wine for ubuntu 
Shell :: how to convert ppk to pem in linux 
Shell :: git pull origin master 
Shell :: check system memory type 
Shell :: download blender ubuntu snap 
Shell :: powershell get empty folders 
Shell :: save output of command to craible bash 
Shell :: how to open boot config raspberry pi command propt 
Shell :: grep process id 
Shell :: docker clean logs 
Shell :: who create git 
Shell :: install bun sh 
Shell :: git stash show files changed 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =