Skip to main content

Questions tagged [bash-array]

7 votes
1 answer
363 views

Consider an associative array in bash (versions 5.2.15(1)-release and 5.2.21(1)-release): declare -A ufs=(); ufs["one"]=1; ufs["two"]=2; ufs["three"]=3 printf '> %s\n' ...
Chris Davies's user avatar
2 votes
1 answer
430 views

This question is similar to this one but it differs from it: Consider this array with string elements which may contain spaces: a@W:$ arr=("eins" "zwei" "eins plus zwei" &...
Adalbert Hanßen's user avatar
0 votes
4 answers
263 views

following example: string=" 'f o o' 'f oo' 'fo o' " array=($string) echo "${array[0]}" outputs: 'f while the expected output is: 'f o o' The only solution I came with is by ...
Zero's user avatar
  • 39
2 votes
1 answer
325 views

I have an array snapshots=(1 2 3 4) When I run printf "${snapshots[*]}\n" It prints as expected 1 2 3 4 But when I run printf "${snapshots[@]}\n" It just prints 1 without a ...
geckels1's user avatar
  • 173
3 votes
2 answers
2k views

I want to download and extract a large zip archive (>180 GB) containing multiple small files of a single file format onto an SSD, but I don't have enough storage for both the zip archive and the ...
Kumaresh Balaji Sundararajan's user avatar
3 votes
4 answers
3k views

#!/usr/bin/bash ARGENT=("Nous devons économiser de l'argent." "Je dois économiser de l'argent.") BIENETRE=("Comment vas-tu?" "Tout va bien ?") aoarrs=("${...
John Smith's user avatar
1 vote
1 answer
1k views

Is there a case where mapfile has benefits over arr+=(input)? Simple examples mapfile array name, arr: mkdir {1,2,3} mapfile -t arr < <(ls) declare -p arr output: declare -a arr=([0])="1&...
Nickotine's user avatar
  • 554
1 vote
3 answers
4k views

I have a function (not created by me) that outputs a series of strings inside of quotes: command <args> “Foo” “FooBar” “Foo Bar” “FooBar/Foo Bar” When I try to assign it to an array (Bash; BSD/...
Allan's user avatar
  • 1,100

15 30 50 per page
1
2 3 4 5 6