Skip to content

Instantly share code, notes, and snippets.

@gabrielfalcao
Last active January 15, 2026 01:45
Show Gist options
  • Select an option

  • Save gabrielfalcao/20cb009eab55bc393d3939bcf188f8e1 to your computer and use it in GitHub Desktop.

Select an option

Save gabrielfalcao/20cb009eab55bc393d3939bcf188f8e1 to your computer and use it in GitHub Desktop.
bash -c 'declare my_arr=( item{1..9});declare -i pos_last=$(( ${#my_arr[@]} - 1 ));echo ${my_arr[@]@A}; echo ${pos_last@A};until [ ${#my_arr[@]} -eq 0 ]; do pos_last=$(( ${#my_arr[@]} - 1 ));echo ${my_arr[@]@A}; echo ${pos_last@A}; set -v;my_arr=(${my_arr[@]:0:${pos_last}});set +v;echo ${my_arr[@]@A}; echo ${pos_last@A};done;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment