Skip to main content

Questions tagged [array]

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

0 votes
0 answers
66 views

In ZSH, how do you set the value of an associative array parameter to an array? e.g., % declare -A a=() % a[first]=(1 2) zsh: a: attempt to set slice of associative array And when I try and append ...
Emily Lockhart's user avatar
1 vote
1 answer
84 views

I'm surprised by the difference in manipulating the array between echo and printf in Bash: printf cannot handle += operator Both printf and echo cannot get results of += out of while loop So, why? I'...
Keelung's user avatar
  • 167
0 votes
3 answers
109 views

I have a string of text and spaces which looks like this: macOS windows arch-linux ubuntu_linux I want to append each item (with whitespace denoting a break between items) to a bash array. How do I ...
EmberNeurosis's user avatar
4 votes
1 answer
140 views

I have a command that produces a list of arguments, quoting then if neccesary (https://docs.python.org/3/library/shlex.html#shlex.quote). I need them to pass them as command arguments in a zsh script (...
Petr's user avatar
  • 1,776
1 vote
4 answers
207 views

So I've ran into a bit of a wall, I have an option in my script that calls a function which allows me to specify a file/directory and then I want to parse that output into a menu tool (using dmenu in ...
hollowillow's user avatar
5 votes
4 answers
965 views

I'm trying to build a wrapper to execute a tool multiple times, then concatenate some of the results. I'd like to pass two sets of files to my wrapper script, then run the tool for each pair of files. ...
Whitehot's user avatar
  • 245
2 votes
2 answers
526 views

I looked through some of the posted threads and none of them cover my query. I have a simple line of code below which prints all the ASCII characters: echo {' '..'~'} I want to be able to use a ...
James Bond's user avatar
3 votes
3 answers
313 views

I want to create a Bash script that outputs the following: Chile: 03:46am, Friday, 27 September, 2024 Tierra Del Fuego: 03:46am, Friday, 27 September, 2024 Falkland Islands: 03:46am, Friday, 27 ...
ZPMMaker's user avatar
3 votes
1 answer
199 views

I don't understand why the array expression is fine. $ set -eu $ echo "${envs[*]}" $ echo "${envs}" bash: envs: unbound variable How can I make bash fail also on such array ...
Jakub Bochenski's user avatar
2 votes
3 answers
690 views

I create an array with a comma for delimiter: echo "${myarray[*]}" # prints: 22,3,2,0,22,4,5,8,22,4,3,6 I'd like to print it to terminal in chunks of four, with a newline and no comma ...
bungee1980's user avatar
1 vote
1 answer
116 views

The loop below finds all of the nodes where the value equals "DOWNLOADING" and grabs the value of the corresponding "bytesdownloaded" node. I was expecting adlBytesDL1[0] to equal ...
 webbytr's user avatar
7 votes
1 answer
282 views

$ perl -wle 'my @388=0..2;' Can't use global @388 in "my" at -e line 1, near "my @388" Execution of -e aborted due to compilation errors. $ perl -wle '@388=0..2;' $ Where can I ...
Dan Jacobson's user avatar
0 votes
3 answers
2k views

I am reading inputs from user in my script with spaces, and those multiple inputs I want to use in a command further down by adding -l in front of each one of those inputs. Is there a way to do this ...
Heyya's user avatar
  • 19
3 votes
1 answer
3k views

I am using jq 1.7 Data I am operating on info.json downloaded by yt-dlp yt-dlp --write-info-json --skip-download https://www.youtube.com/watch?v=vlIO-7Rpi7c JQ - Task Now I want to remove all array ...
Porcupine's user avatar
  • 2,176
0 votes
2 answers
309 views

In TCL, I have a few arrays whose names have a numeric suffix (i.e., whose names end with a number), like below: array set ps0 [ list 0 15.885 1 55.43 1 0.254 2 0.227 3 0.177 ] array set ps1 [ list 0 ...
poppycock's user avatar

15 30 50 per page
1
2 3 4 5
43