LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Old

Bash arrays as Python lists (sort of)

Posted 08-08-2015 at 12:38 PM by HMW
Updated 08-08-2015 at 12:44 PM by HMW

If you have some experience with higher level programming languages (such as Python for instance), you have undoubtedly came across lists and arrays.

There are arrays in Bash too, but there is a pitfall when you delete items from an array in Bash; the index disappears with the item!

First, consider this example with a list in Python:
Code:
>>> myList = ['foo', 'bar', 'baz']
>>> myList
['foo', 'bar', 'baz']
>>> del myList[0]
...
HMW
Member
Posted in Uncategorized
Views 2275 Comments 0 HMW is offline

  



All times are GMT -5. The time now is 03:43 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration