Skip to main content

All Questions

0 votes
2 answers
136 views

Using variables inside the for loop in shell [duplicate]

I'd like to use variables inside the for loop in shell. My current code: VAA="1st_first" VAB="2nd_second" VAC="3rd_third" for i in VAA VAB VAC; do if [[ "${i}...
Feriman's user avatar
  • 1,059
1 vote
1 answer
536 views

The $@ variable is not working in a for loop, trying to iterate through a users list

PROBLEM: I can't get the $@ variable to do what I want in a for loop, the loop only sends one name into the file while looping, it should loop through all the arguments and write them to the file ...
somethingSomething's user avatar
7 votes
2 answers
20k views

How to convert an input parameter to integer value in a for loop in bash? [duplicate]

in my bash script I try to use a number as an input variable for a for loop I run the script as ./script.sh InputFolder/ Number_of_iterations the script should work inside the given folder and run a ...
Assa Yeroslaviz's user avatar
1 vote
2 answers
21k views

using "for" loop read a file line by line continuously by considering each line as a input

Consider a file.txt file with below values one,two three,four five,six six,seven red,tree Need a shell script command to perform below activity For loop in which the loop should be continuously ...
user8554534's user avatar
3 votes
2 answers
130 views

using the variable "file" obtained from `for "file" in` and pass to another script fails [closed]

I am trying search for all .mkv files in my current folder, then using mediainfo I want to put the height from its meta data to a variable, but it seems it is failing. This snippet: height=$(...
arvil's user avatar
  • 670