All Questions
18 questions
0
votes
1
answer
380
views
Script to find x265 files then output name
I'm trying to make a script that crawls through a giving directory and list all files that are x265. Using mediainfo and can see if the file is x264 or x265, I then use sed to clean up the text. The ...
0
votes
1
answer
1k
views
awk command inside bash shell script loop
I have a bash script which is supposed to go through a series of files text file. I have written a for loop to do this job automatically for me but I am not getting any output files when the script ...
0
votes
1
answer
124
views
setting number of integers for unlimited argumments
I'm not quite sure what I'm doing here but I need to be able to get an unlimited number of integers to be provided as arguments
so far I have
for sum in $@; do
sum=$(($1 + $2 + $3))
done
echo ...
0
votes
1
answer
1k
views
Bash script that runs parallel threads slows down substantially over several hours
I have a script I came up that simply executes another process into the background that attempts to control the max number of processes running (300 in this case).
It initially executes scripts at ...
2
votes
1
answer
1k
views
Changing a file with values from another file - Bash script
I am trying to write a script that takes two files as arguments and changes an .svg file with values from a .csv file. Csv file consists of lines with two values; id,colour. I need to find the id in ...
2
votes
3
answers
6k
views
Progress bar to display progress based on number of files found/completed in for loop?
Is there a progress bar that can show visually completed progress based on the number of detected files found and completed in a for loop like the one below?
mkdir -p hflip; for i in *.mp4; do ffmpeg ...
0
votes
1
answer
41
views
Bash script to link networked account directories to local account directories
I'm working on a script that will create a local user account, and link local account directories to networked account directories. The only directories I would like to be created and linked are the ...
-1
votes
1
answer
321
views
Why does this for loop ignore my variable? [duplicate]
I am trying to do a simple script which runs a few commands N number of times, determined by the user's input. However, when it comes to run the commands (in a for loop) - The variable is ignored:
...
2
votes
1
answer
188
views
How can I sum the time based on usernames?
Basically, I want to see how much time every user spent logged in.
(username) pts/0 (IP adress) Tue Dec 12 17:51 - 18:14 (00:22) - this is how one line looks in the last command. The ...
1
vote
2
answers
4k
views
Go to the beginning of the loop in bash
I am using an if condition inside a for loop. If the if condition returns yes, then I'd like to go to the start of the for loop again. Is this possible in bash?
#!/bin/bash
for i in /apps/incoming/*....
0
votes
4
answers
1k
views
How to repeatedly alternate between two (or more) commands?
I'd like to repeatedly iterate over, alternate between, and/or cycle through multiple commands; in a kind of pattern or loop. The desired end result could be thought of as not totally unlike watch.
I'...
15
votes
4
answers
15k
views
How do I get 0-padded numbers in {} (brace expansion)?
I'm trying to write a simple script to retrieve memory and swap usage from a list of hosts. Currently, the only way I've been able to achieve this is to write 3 separate scripts:
for a in {1..9}; do ...
26
votes
4
answers
5k
views
How do I replace AND (&&) in a for loop?
I'd like to find an equivalent of
cmd 1 && cmd 2 && ... && cmd 20
but with commands expressed within a for loop like
for i in {1..20}
do
cmd $i
done
What would you suggest ...
0
votes
1
answer
2k
views
Loops: for vs while... beyond the basics. Subtle differences/pros/cons for my code? [closed]
I have been writing/refining a relatively complex code for the past year, and learning bash along the way. My code is filled with functions that have complex multi-level while loops. I've recently ...
2
votes
1
answer
2k
views
Make whiptail work in a for loop
I have a bash script that checks ping for 163 sites(stores around the country), which is this:
#!/bin/bash
#storestest.sh
#version 0.9.2
clear;
printf "Check stores procedure started; `date +"%d/%m/%...