You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# to avoid the ibnormal behaviour of the echo command always create files using nano or vim commnad while working in windows
# Getting the list of names from a file in the names array
mapfile -t names < Names.txt
# Assign a new variable for the all name list from array
namelist="${names[@]}"
#index start from zero in array of linux , while working with subarray , first number after : is indicate index and second : tell how many element should contain
echo print 2 elements starting from index=1
echo "${names[@]:1:2}"
echo print print last two names of array
echo "${names[@]: -2}"
echo printing the value seperated by space of arraylist :
echo $namelist
echo printing the list items each at new line from array