Sponsored Content
Full Discussion: for loop syntax trouble
Top Forums Shell Programming and Scripting for loop syntax trouble Post 302184674 by visitorQ on Saturday 12th of April 2008 12:13:13 PM
Old 04-12-2008
thank you so much for the quick reply buddy! i ended up doing this which worked just fine:
Code:
#!/bin/sh

for i in `seq 1 ${1}`
do
    echo "Welcome ${i} times";
done

but your code seems to be cleaner and make more sense, so i'll adopt that method instead.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. Shell Programming and Scripting

for loop syntax

hi, I have to use for loop in my script. The below code is providing an output, 1,2,3,4,5..n. But i need to display the values one by one eg: it has to display the first value then exit from the loop and display the second value then exit till n(last value). for i in 1,2,3,4,5..n do ... (2 Replies)
Discussion started by: sreelu
2 Replies

5. 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

6. UNIX for Dummies Questions & Answers

for-loop syntax

%%%%% (3 Replies)
Discussion started by: lucasvs
3 Replies

7. 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

8. UNIX for Dummies Questions & Answers

Trouble understand and using for loop

Good evening all I have what might be a simple problem to solve but I do not know how to solve it myself. I am writing a bash script and my code looks something like this: mp3=`ls | grep \.mp3` for f in $mp3 do echo $f done Basically what I want to do is look through the current... (4 Replies)
Discussion started by: mistsong1
4 Replies

9. 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

10. Shell Programming and Scripting

What does xx mean in this while loop syntax?

I have a shell script which has this while loop line "while read tblName xx; do..." I understand how while loop works but don't know what does this xx stands for? (1 Reply)
Discussion started by: later_troy
1 Replies
ganeti-cleaner(8)						   Version 2.5.2						 ganeti-cleaner(8)

Name
       ganeti-cleaner - Ganeti job queue cleaner

Synopsis
       ganeti-cleaner

DESCRIPTION
The ganeti-cleaner is a periodically run script to clean old job files from the job queue archive and to remove expired X509 certificates and keys. ganeti-cleaner automatically removes all files older than 21 days from /var/lib/ganeti/queue/archive and all expired certificates and keys from /var/run/ganeti/crypto. REPORTING BUGS
Report bugs to project website (http://code.google.com/p/ganeti/) or contact the developers using the Ganeti mailing list (ganeti@google- groups.com). SEE ALSO
Ganeti overview and specifications: ganeti(7) (general overview), ganeti-os-interface(7) (guest OS definitions). Ganeti commands: gnt-cluster(8) (cluster-wide commands), gnt-job(8) (job-related commands), gnt-node(8) (node-related commands), gnt- instance(8) (instance commands), gnt-os(8) (guest OS commands), gnt-group(8) (node group commands), gnt-backup(8) (instance import/export commands), gnt-debug(8) (debug commands). Ganeti daemons: ganeti-watcher(8) (automatic instance restarter), ganeti-cleaner(8) (job queue cleaner), ganeti-noded(8) (node daemon), ganeti-masterd(8) (master daemon), ganeti-rapi(8) (remote API daemon). Ganeti htools: htools(1) (generic binary), hbal(1) (cluster balancer), hspace(1) (capacity calculation), hail(1) (IAllocator plugin), hscan(1) (data gatherer from remote clusters). COPYRIGHT
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc. Permission is granted to copy, distribute and/or modify under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. Ganeti ganeti-cleaner(8)
All times are GMT -4. The time now is 11:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy