Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

How can I remove an element from an array completely?

Just use array syntax on the assignment and quote your variable:

array=("${array[@]:1}") #removed the 1st element

Edit according to question in comment. For [email protected] you can use it like this:

set -- "${@:2}" #removed the 1st parameter

Tags:

Shell

Bash

Array

Shell Script

Related

Simulate empty STDIN to detached command Processor usage increases with 4GB RAM installed Avoiding busy waiting in bash, without the sleep command How to print apparently hidden environment variables? Virtualbox: Mount a shared folder in Guest FreeBSD from Host Ubuntu Mount cifs Network Drive: write permissions and chown Double and triple substitution in bash and zsh ${!FOO} and zsh How to monitor RAM ECC errors on Ivy Bridge Xeon E3 processor in Linux? Get monitor make and model and other info in human readable form cron ignores variables defined in ".bashrc" and ".bash_profile" (SSH) Is it dangerous to close terminal without "exit"?

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy