Bootstrap FreeKB - Bash (Scripting) - Get the first element from a List
Bash (Scripting) - Get the first element from a List

Updated:   |  Bash (Scripting) articles

Let's say you have an list named fruit that contains the following values.

fruit=(banana apple orange grapes)

 

Here is how you can return the first item from the list.

echo ${fruit[1]}

 

Which in this example should return "banana".

banana

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 836b42 in the box below so that we can be sure you are a human.