Skip to main content

Questions tagged [for]

A tag to denote any questions relating to for loops

0 votes
1 answer
58 views

I just wanted to build a simple bash script that inverted a 'hex color code' (made up of 3 pairs of 2-digit hexadecimal numbers, in the format #RRGGBB). In my first code block I attempt to perform ...
Signor Pizza's user avatar
2 votes
3 answers
604 views

I have a bash variable as such HAP="$(echo ${d} | cut -f 7 -d '/' | sed 's/[A-Z,0-9]\+//' | sed 's/_//')" that when is run as part of a script return either ref or hap. Now, I have another ...
Matteo's user avatar
  • 387
0 votes
1 answer
127 views

I'm looking to batch compress some pdfs, using the convert to/from ps trick outlined elsewhere. I have a function defined in an .zshrc file: function pdfcompress() { for f in "$1"; do ...
sporkl's user avatar
  • 103
0 votes
1 answer
75 views

I'm trying to create stack of multiple vms on KVM_HOST with terraform. The catch is, I'm using pxeboot & kickstart to do installation. Kickstart file needs to carry some dynamic information, like ...
Sollosa's user avatar
  • 2,009
2 votes
1 answer
189 views

I'm not an experienced programmer. So maybe it's obvious for you why the break command in this script does not terminate the loop, but I can't see what is causing the problem. I want to use the script ...
Shakesbeer's user avatar
0 votes
1 answer
99 views

I am trying to read a variable with spaces on prompt and trying to use in a for loop., For example: Enter the items to read separated by space... apple orange kiwi read items for i in "$...
sabarish tr's user avatar
-1 votes
1 answer
103 views

Imagine I have two folders in my current working directory: back/ and front/. I am trying to enter inside each of them and do some stuff. From the simple script below: for dir in */ ; do echo &...
Rigel F. do C.'s user avatar
-3 votes
4 answers
264 views

I am looking for a possibility to catch in a repeating text pattern all variable amount of lines between them and then do an action with it in bash. Example text: Total: text1 text2 Total: text3 Total:...
André Letterer's user avatar
4 votes
2 answers
496 views

I have several servers which have several files with deploy date info I need to parse, and get a local copy of the files which are 2 months old or older. #!/bin/bash # split on new line not space # ...
Nickotine's user avatar
  • 554
0 votes
2 answers
398 views

If I ls files without a for loop in a remote host everything is fine however, if I capture the ls in a variable and try to echo each file it fails as the variables don't expand/have a value. What I ...
Nickotine's user avatar
  • 554
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
0 votes
2 answers
333 views

I have a python program that requires 2 arguments input-file and output-file. It reads input-file and creates a copy of that file with some modifications in the output-file. I created a text file with ...
Data Engineer's user avatar
1 vote
2 answers
3k views

I have a variable that contains a list of strings, one per line, to be looped over in a for...in...do...done command. I move regularly between bourne shell and zsh. As far as I can understand it, zsh ...
Stilez's user avatar
  • 1,311
0 votes
1 answer
1k views

I think I'm pretty close to having a code which will start at a directory, then spit out a fixed copy, using fd (instead of find) and ffmpeg. I have written the if statement here as psudo-code: for i ...
1toneboy's user avatar
  • 503
0 votes
3 answers
762 views

I want to check if each .bam file is accompanied with a .bai file. So if clean_xyz_1.sorted.bam is present clean_xyx_1.sorted.bam.bai should also be present. Each file has a variable string in the ...
user3637557's user avatar

15 30 50 per page
1
2 3 4 5
31