Sponsored Content
Full Discussion: abstract.sh
Top Forums Shell Programming and Scripting abstract.sh Post 302618293 by complex.invoke on Tuesday 3rd of April 2012 10:09:48 PM
Old 04-03-2012
The most easy way to get the same result is
Code:
echo {0..2}{0..2}{0..2} | xargs -n 3

but, if we don't perform it this way, instead,generally speaking, we must need three nested-loop to accomplish it
Code:
for((i=0; i<3; ++i)); do
   for((j=0; j<3; ++j)); do
      for((k=0; k<3; ++k)); do
          echo -n "${i}${j}${k} "
          (( k == 2 )) && echo
      done
   done
done

My purpose is just to show that there are always better solutions to perform the tasks if only you can use your imagination as much as possible!
The post here is intended to show some core concepts and skills that we can perform in shell scripting!
Feel free to delete it if you consider it's useless, Neo!Smilie
 

4 More Discussions You Might Find Interesting

1. Programming

Compiling multiple cpp files (abstract factory pattern)

Hi all, I have been working with java for awhile and because of my school projects I needed to switch C++. I tried to implement some patterns in C++ but unfortunately I couldn't. Specifically, I tried to implement abstract factory pattern but since I used separated files (habitual behavior from... (4 Replies)
Discussion started by: SaTYR
4 Replies

2. Programming

how abstract class differs in Java and C++?

hello all, i want to know if there is any difference in working and syntax declaration of abstract class in Java and C++. (1 Reply)
Discussion started by: haravivar
1 Replies

3. Programming

C++ abstract (singleton) factory implementation...

I want to create an abstract factory template which will allow me to pass in an "ID" for a subclass and return the singleton instance of that class stored in the factory. It'd be easy to adapt for "multi-ton", but for its present use this isn't necessary. The requirements are: - I don't want... (2 Replies)
Discussion started by: DreamWarrior
2 Replies

4. Programming

Java Abstract Classes

Can anyone tell me if this is correct when creating classes in Java? public abstract class Animal { public class Point { public int x,y; } public class Animal { protected Point loc; protected String name; protected Random rng; String... (3 Replies)
Discussion started by: totoro125
3 Replies
libcurl(3)						      libcurl easy interface							libcurl(3)

NAME
libcurl-easy - easy interface overview DESCRIPTION
When using libcurl's "easy" interface you init your session and get a handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use curl_easy_init(3) to get the handle. You continue by setting all the options you want in the upcoming transfer, the most important among them is the URL itself (you can't transfer anything without a specified URL as you may have figured out yourself). You might want to set some callbacks as well that will be called from the library when data is available etc. curl_easy_setopt(3) is used for all this. When all is setup, you tell libcurl to perform the transfer using curl_easy_perform(3). It will then do the entire operation and won't return until it is done (successfully or not). After the transfer has been made, you can set new options and make another transfer, or if you're done, cleanup the session by calling curl_easy_cleanup(3). If you want persistent connections, you don't cleanup immediately, but instead run ahead and perform other transfers using the same easy handle. libcurl 7.10.7 12 Aug 2003 libcurl(3)
All times are GMT -4. The time now is 05:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy