We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,389 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

for loop in vi editor in ubuntu

can any body give me the correct syntax of for loop to be used in vi editor in ubuntu.....
i know like this....:-

for (( initialisation;condition;increment ))
do
    "statements for do"
done
2
Contributors
4
Replies
1 Day
Discussion Span
9 Months Ago
Last Updated
5
Views
vinay7868
Light Poster
32 posts since Aug 2012
Reputation Points: 0
Solved Threads: 1
Skill Endorsements: 0

hi,

can you be more precise about what your trying to do?
what's the goal of the for loop?
are you writing a vi script, or are you using vi to write a shell script?

Watael
Junior Poster
121 posts since Apr 2012
Reputation Points: 4
Solved Threads: 26
Skill Endorsements: 2
echo "Pattern1"

for (( $i=0;$i<=5;$i++ ))
do
    for (( $j=0;$j<=i;$j++ ))
    do
        echo $j;
    done
    echo "";
done

//i want to print a pattern but it gives me a for syntax error......
vinay7868
Light Poster
32 posts since Aug 2012
Reputation Points: 0
Solved Threads: 1
Skill Endorsements: 0
for (( i=0; i<=5; i++ ))

i=0 is an assignment, as is i++ inside double parenthesis.

Watael
Junior Poster
121 posts since Apr 2012
Reputation Points: 4
Solved Threads: 26
Skill Endorsements: 2

ya thnks it worked.....

vinay7868
Light Poster
32 posts since Aug 2012
Reputation Points: 0
Solved Threads: 1
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.5175 seconds using 2.64MB