Questions tagged [array]

A array is the simplest data-structure for storing items in continuously memory

628 questions
0
votes
0 answers

Print value from key in bash associative array

I'm trying to match the first three characters of a specific hostname to a key in an associative array. And then print the matching value. The code I have below prints all the values in the array. !/bin/bash host=$(hostname | cut -c1-3) declare -A…
Jdon1
  • 1
0
votes
1 answer

RHSA installation in RH7

this is a question similar to the mine I asked you yesterday (how to iterate installation in a row). I need a script that starting from an RHSA list as argument, separated by " " spaces, it performs this command in one row but with commas instead of…
intore
  • 399
0
votes
3 answers

Picking specific array element

I have just started reading about "$@" and "$*", I wanted to know if I can specifically point to an element in the "$@" array. Like without using any loop, I want to be able to pick element number 3 from "$@". Is there a way of doing this like…
0
votes
1 answer

Unique strings in bash

I have an array array=(src/ucode/pkgs/get_ch.c qa/tests/ucode/chktest.pl src/ucode/pkgs/get_ch.c src/profile/settings.txt src/ucode/pkgs/main_pf.c src/ucode/pkgs/get_ch.c src/ucode/pkgs/main_ch.c src/ucode/pkgs/main_pf.c) I need to get unique…
tony
  • 61
  • 3