bash array operations

Home -> Programming -> Shell script -> Bourne shells

18603 views

From the computer of: hpx (3 recipes)
Created: Jun 08, 2005


2 comments:
View all comments

Add a comment

Add to:
Add to stumbleuponAdd to del.icio.usDigg itAdd to FURL

sometimes we need to remove one element from an array for example we remove the element 2 (third) from array


array=("hello" "i" "like" "bash")
i=2
array=(${array[@]:0:$i} ${array[@]:$(($i + 1))})

Subscribe to the Tech-Recipes Newsletter

You can get tips like this delivered in your email every week!

Enter your Email

We will never, ever sell your email address or spam you.




2 Recipe comments: View comments

the bash array operations example is broken by jonnyhacker
Re: the bash array operations example is broken by utoddl



Related recipes:

  bash shell script iterate through array values
  bash shell script declaring/creating arrays
  bash shell script accessing array variables
  queue and stack using array
  Bourne/bash shell scripts: if statement syntax
  Bourne/bash shell script for loop syntax
  Bourne/bash shell scripts: case statement
  Bourne/bash shell script: while loop syntax
  Determine if file exists in a Bourne/bash shell script
  Simple Menu for User Input

 

Sponsored links

 

Login

Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.