Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

loop from array bash

#!/bin/bash
# declare an array called array and define 3 values
array=( one two three )
for i in "${array[@]}"
do
	echo $i
done
Comment

Bash script using input to iterate through array

echo -e "Enter value between 0-5: c"
read -r readusr

month=("JAN" "FEB" "MAR" "APR" "MAY" "JUN")

echo -e "User chosen month is: c"
echo ${month[$readusr]}

echo -e "All months are: c"
echo ${month[@]}

echo -e "Numbers of months are: c"
echo ${#month[@]}
Comment

PREVIOUS NEXT
Code Example
Shell :: mac secure erase free space 
Shell :: python convert json string to module object class 
Shell :: powershell task scheduler 
Shell :: how to generate a resolver in the cli 
Shell :: delete file kali linux 
Shell :: flutter run web public network 
Shell :: kubernetes Networking best option 
Shell :: cannot find module for path github.com/confluentinc/confluent-kafka-go/kafka/librdkafka_vendor 
Shell :: Delete fist line in a file 
Shell :: why showing different +++++++++------ count git diff command 
Shell :: Fix for infinite log Linux bug 
Shell :: git create branches 
Shell :: find syntax in linux 
Shell :: sudo apt-get remove 
Shell :: switching branch in git 
Shell :: powershell script to run powershell script 
Shell :: download anaconda for jupyter notebook 
Shell :: 2&1 linux pipe stderr, stdin, stdout 
Shell :: batch wait seconds 
Shell :: git: Download specific commit from git repository : remote 
Shell :: cat to line number 
Shell :: Installing nano on Debian/Ubuntu machines 
Shell :: command to change user expiry date 
Shell :: install nomad on aws linux 2 
Shell :: ros2 galactic build from source 
Shell :: curl command download from s3 
Shell :: micronucleus: error while loading shared libraries: libusb-0.1.so.4: cannot open shared object file: No such file or directory 
Shell :: kde plasma pop os 
Shell :: How to search within a file when displayed with less program 
Shell :: trickbot mikrotik 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =