Sponsored Content
Top Forums Shell Programming and Scripting Why the results of these two code fragments are not the same? Post 303030168 by Don Cragun on Thursday 7th of February 2019 12:04:50 AM
Old 02-07-2019
But, the code you've written in your shell scripts acts more like your C++ code with the inner loop changed from:
Code:
    for(vector<string>::size_type j= i+ 1; j< myvector.size(); ++j)

to:
Code:
    for(vector<string>::size_type j= 0; j< myvector.size(); ++j)

There doesn't appear to be any attempt to keep from checking one element against itself in your command-line argument vector in either of your shell scripts.

I repeat: "What is the logic in both of your scripts behind the variable named counter? Why does it matter what the value of $counter is when trying to determine whether or not two command-line arguments are the same?"
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

fragments in Solaris 8

When discussing inodes and data blocks, I know Solaris creates these data blocks with a total size of 8192b, divided into eight 1024b "fragments." It stores data in "contiguous" fragments and solaris doesn't allow a file to use portions of two different fragments. If the file size permits, then the... (4 Replies)
Discussion started by: manderson19
4 Replies

2. Post Here to Contact Site Administrators and Moderators

results survey

Hi guys! I was wondering what the outcome was of your survey of a few months ago? One of the questions was if people were willing to pay for additional services like an own account, like username@unix.com with mail box, etc. Sorry if I missed the results if you had already posted them. Ivo (1 Reply)
Discussion started by: Ivo
1 Replies

3. Solaris

ipfilter blocking ip fragments

For some reason ipfilter is blocking inbound fragmented ip packets (the packets are larger than the interface's MTU) that are encapsulating UDP segments. The connection works, so I know ipfilter is letting some traffic through, it is just a lot slower than it should be. Rules that allow the... (3 Replies)
Discussion started by: ilikecows
3 Replies

4. IP Networking

Solaris 11 Express NAT/Router IP Fragments

Upon replacing my linux router/server with a Solaris one I've noticed very poor network performance. The server itself has no issues connecting to the net, but clients using the server as a router are getting a lot of IP fragments as indicated from some packet sniffing I conducted. Here was my... (3 Replies)
Discussion started by: vectox
3 Replies

5. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

6. Shell Programming and Scripting

Why use different FS, the results is different?

# echo '1 2 3 ' | awk -F' ' '{print NF}' 3 # echo '1:2:3:' | awk -F':' '{print NF}' 4 (1 Reply)
Discussion started by: lazycat79
1 Replies

7. Shell Programming and Scripting

Extract fragments from file

I have a .xml file that looks something like this : <measInfo> ......... string1 ......... </measInfo> <measInfo> ...... string2 ........ </measInfo> I want to extract only the 'chunk of file' from '<measInfo>' to '</measInfo>' containing string1 (or a certain string that I... (13 Replies)
Discussion started by: black_fender
13 Replies

8. Shell Programming and Scripting

I want to add a variable for the results from the formula of one variable and results of another var

Good morning all, This is the file name in question OD_Orders_2019-02-19.csv I am trying to create a bash script to read into files with yesterdays date on the file name while retaining the rest of the files name. I would like for $y to equal, the name of the file with a formula output with... (2 Replies)
Discussion started by: Ibrahim A
2 Replies
Vector(7rheolef)						    rheolef-6.1 						  Vector(7rheolef)

NAME
Vector - STL vector<T> with reference counting DESCRIPTION
The class implement a reference counting wrapper for the STL vector<T> container class, with shallow copies. See also: @quotation The Standard Template Library, by Alexander Stephanov and Meng Lee. @end quotation This class provides the full vector<T> interface specification an could be used instead of vector<T>. NOTE
The write accessors T& operator[](size_type) as in v[i] may checks the reference count for each access. For a loop, a better usage is: Vector<T>::iterator i = v.begin(); Vector<T>::iterator last = v.end(); while (i != last) { ...} and the reference count check step occurs only two time, when accessing via begin() and end(). Thus, in order to encourage users to do it, we declare private theses member functions. A synonym of operator[] is at. IMPLEMENTATION
template<class T> class Vector : private smart_pointer<vector_rep<T> > { public: // typedefs: typedef iterator; typedef const_iterator; typedef pointer; typedef reference; typedef const_reference; typedef size_type; typedef difference_type; typedef value_type; typedef reverse_iterator; typedef const_reverse_iterator; // allocation/deallocation: explicit Vector (size_type n = 0, const T& value = T ()); Vector (const_iterator first, const_iterator last); void reserve (size_type n); void swap (Vector<T>& x) ; // accessors: iterator begin (); const_iterator begin () const; iterator end (); const_iterator end () const; reverse_iterator rbegin(); const_reverse_iterator rbegin() const; reverse_iterator rend(); const_reverse_iterator rend() const; size_type size () const; size_type max_size () const; size_type capacity () const; bool empty () const; void resize (size_type sz, T v = T ()); // non-standard ? private: const_reference operator[] (size_type n) const; reference operator[] (size_type n); public: const_reference at (size_type n) const; // non-standard ? reference at (size_type n); reference front (); const_reference front () const; reference back (); const_reference back () const; // insert/erase: void push_back (const T& x); iterator insert (iterator position, const T& x = T ()); void insert (iterator position, size_type n, const T& x); void insert (iterator position, const_iterator first, const_iterator last); void pop_back (); void erase (iterator position); void erase (iterator first, iterator last); }; rheolef-6.1 rheolef-6.1 Vector(7rheolef)
All times are GMT -4. The time now is 06:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy