Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Trouble understand and using for loop Post 302794821 by Don Cragun on Tuesday 16th of April 2013 08:56:19 PM
Old 04-16-2013
Quote:
Originally Posted by mistsong1
So from my limited understanding, after I pass in a list I can then do a loop with anything that ends in a .mp3 extension, I don't necessarily have to pass in the variable by saying $mp3 when I make a loop?
By setting mp3 to a list of filenames containing .mp3 and then expanding $mp3 in the for loop, you went through the loop seven times for the file named:
Code:
Tom Petty - Running Down a Dream.mp3

with file set to "Tom", "Petty", "-", "Running", "Down", "a", and "Dream.mp3" instead of going through the loop once with file set to "Tom Petty - Running Down a Dream.mp3" which I did by letting the shell expand the list of filenames ending in .mp3 in the for loop.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

can't understand

how i can download this game n start it :S (5 Replies)
Discussion started by: BoyArcher
5 Replies

2. Shell Programming and Scripting

Start more than one database - trouble with for loop

I have seen this done before - and maybe there is a better way too. I want to be abe to use a for loop (or other better method) to loop through the database instance names that are part of the script - not an external file where a read might be ok. Here is what I have and I know won't work -... (5 Replies)
Discussion started by: dave-mentor
5 Replies

3. Shell Programming and Scripting

Loop Trouble

Can anyone tell me what's wrong with my code here? I'm experiencing weird behavior... I am using 'j' to go down a list filenames saved in a .txt file and prompting the user whether or not she would like to delete each one. This works all well and fine the first run through, but then instead of... (2 Replies)
Discussion started by: RSymphony
2 Replies

4. Shell Programming and Scripting

for loop syntax trouble

i don't get what's wrong here. i'm writing a shell script that takes 1 argument (a number) from the command-line, but it's throwing an error: Syntax error: Bad for loop variable doesn't make much sense for (( i = 1; i = ${1}; i++ )) # error points to this line everytime do echo... (9 Replies)
Discussion started by: visitorQ
9 Replies

5. Shell Programming and Scripting

Trouble with a file path as awk output in for loop

When I run the following command in the shell it works fine. It prints a city name and then a path for a file. ~$ for i in `awk -F':' '{print $0}' /home/knoppix/Desktop/data/subs | grep -m 1 $ city | sed "s/:/ /"` >do >echo $i >done Now, when I place it in this shell script (sh) it prints... (6 Replies)
Discussion started by: afroCluster
6 Replies

6. Shell Programming and Scripting

Do not understand why my while loop fail (bash)

Hi again :) I still need your help now... #!/bin/bash SIZE=`ls -s text.txt` while do done My problem is that the line "while ..." still print the same value after the first loop. In one instruction change the size of text.txt I've run my bash script in debug mode, and the... (6 Replies)
Discussion started by: Link_
6 Replies

7. Shell Programming and Scripting

can't understand!

Hi All, can you please help me to figured out what's the meaning of this. ${SERVER_DATABASE} -b << EOF 2>>/dev/null THanks, (3 Replies)
Discussion started by: nikki1200
3 Replies

8. Programming

trouble with loop counting

HI there, I am trying to count manually what this code does but I am stuck and I don't learly see the result. The code works and it compiles and runs but I just don't follow the value of var. #include<stdio.h> #include<stdlib.h> #include<sys/types.h> #include<unistd.h> #include<wait.h>... (2 Replies)
Discussion started by: bluetxxth
2 Replies

9. UNIX for Dummies Questions & Answers

Trouble displaying parameters passed into a for loop

#!/bin/bash function check_num_args() { if ; then echo "Please provide a file name" else treat_as_file $* fi } function treat_as_file() { numFiles=$# for((i=1;i<=$numFiles;i++));do echo $i ... (3 Replies)
Discussion started by: kikilahooch
3 Replies

10. Shell Programming and Scripting

Considerable trouble with for loop in combination with awk

I have the text file where each line has the format: chr10 101418889 101418904 0.816327 Right now the interval between column 2 and 3 is 15. I only want the two consecutive positions starting at position 1, write it to a file, then move up one position write to file etc. So that: ... (1 Reply)
Discussion started by: jfern
1 Replies
qmp3report(1)							 quelcom man pages						     qmp3report(1)

NAME
qmp3report - report mp3 files and directories SYNOPSIS
qmp3report [option]... file... DESCRIPTION
qmp3report reads mp3 files or directories containing mp3 files and gives information about them. qmp3report can output the reports with plain text or in html format. using the latter format, you can navigate your mp3 directories with a web browser. OPTIONS
-a, --all report all files, not just files with suffix mp3. -A, --show-all implies --show-dirs, --show-files and --summary. show report for files and directories and a summary report. -d, --dirs show a report for every directory containing reported files/directories. note that if option --all is not set, only will be reported those directories containing mp3 files. -f, --files show a report for every reportable file (see --all). -h, --help show a brief help and exit. -H, --html output in html format (default is plain text). -r, --recursive scan directories. -s, --summary show a summary report. -S, --split split report across visited directories. qmp3report leaves in each visited directory a file with the report for that directory, independently of the output format. the name of the report file is the name of the directory with extension .txt or .html depending on the selected output format. -v, --verbose show more detailed info. -V, --version show version and exit. BUGS
variable bit rate (vbr) streams are detected by reading the initial (5) frames in the stream. if their bit rate field differs, the entire stream is read to compute the duration time with accuracy (see manual info for qmp3info). if vbr is not detected, qmp3report reads only the first frame in the stream and calculates the duration supposing that (1) the entire stream is composed by valid frames and (2) all the frames have the same bit rate. this is a fast way to compute the duration of the stream, but it is not exact: there's an error of 0.3% aprox. the htmlize function, which converts file names in a suitable form for html format (ie. replacing spaces with %20), is not bulletproof. tests have been done only with mpeg version 1 layer iii streams, though it may (or not) work with other versions or layers. AUTHOR
dmanye@etse.urv.es http://www.etse.urv.es/~dmanye/quelcom/quelcom.html SEE ALSO
qmp3info(1), qmp3join(1), qmp3cut(1), qmp3check(1) qwavinfo(1), qwavjoin(1), qwavcut(1), qwavsilence(1), qwavfade(1), qwavheaderdump(1) quelcom 0.4.0 february 2001 qmp3report(1)
All times are GMT -4. The time now is 06:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy