I’m learning to script in Bash. I have an CSV file, which contains next lines: Need to create arrays from this, where first entry is array name, eg. Here is my script: When I try with csv file, containing only two first string (numbers and colors), code works well. And if i try to with number, colors, c…
Tag: arrays
Delete newlines from all elements of a array in shell
I try to solve a problem in shell. Im trying to find a way to delete all newlines from each element of an array. I tried to do this with a for loop. The Strings look like this (always three numbers, separated with dots) “14.1.3n” and I need to get rid of the newline at the end. This is what
JavaScript Follow / Unfollow Button
I would like to make a simple JavaScript program witch allow you to like and dislike. So actually I am new in JavaScript it’s a bit difficult me yet. So when you click onto the Follow button it will increase the “countF” variable’s amount with 1, and change the button text to “Un…
How to declare a global array within an exec in javascript
I’m writing a js script to locate all pid files on a server, extract the pids and then run ‘ ps -fp {pid} ‘ on each of it and extract the memory usages. This is what I’ve got so far: The issue is pidsarr is not getting updated, probably since it’s not declared global or something…
How can i display the first five lines that differ between 2 files, in a shell script?
I ve tried using 2 arrays to compare the 2 files, but i m a rookie and i don’t know how to do it: Answer Do not use backticks `. Use $(..) instead. So instead of if ( “$i” == “$j” ) do if [ “$i” != “$j” ]. vec_fis_1 and vec_fis_2 are not arrays – ${v…
Shell Script : Send html formatted email while inside an array
I am trying to send html formatted email via shell script while reading a tab separated text file in array and need some help. I can see there were multiple similar question on forum and I also have multiple working scripts which can send html emails but I am not able to fit that code when I am inside an
Access List of Items from cURL Result
If u go to this url : http://artii.herokuapp.com/fonts_list, you will see a list of 417 items on the list. I’m trying to create a variable to store/access those list. I could not get it to work. I kept getting Any hints on how to do it ? Answer Starting with the assumption that the result is, in fact, o…
Obtaining IP from command ‘host’ executed inside python
I have this function to show me the 1st ip of a domain: But this only shows me the first ip. I’d like to show only the ip’s. The marker is for not having “has address” as shown below (imagine I input “reddit.com”: I want to show only the ips, not reddit.com has addressnor o…
Bash for loop on two arrays
I have two arrays that I need to iterate over but I can’t figure out how to get the combination of both arrays… Answer
What does “~[]” do?
I saw the following line of code here . I don’t understand, what does empty array script([]) do? Also, What is the purpose of ~[] in C? Answer The linked program seems to be logging its actions in some invented semi-formalized language. This logging “language” is not C. The string literal in…