1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Dominik [7]
2 years ago
6

In the following shell scripting extract, the initial values of variables s, c and p are 0, 1, 1 respectively. What will be the

final value of s, at the end of the while loop?

Computers and Technology
1 answer:
____ [38]2 years ago
3 0

Answer:

The first example simply counts the number of lines in an input file. It does so by iterating over all lines of a file using a while loop, performing a read operation in the loop header. While there is a line to process, the loop body will be executed in this case simply increasing a counter by ((counter++)). Additionally the current line is written into a file, whose name is specified by the variable file, by echoing the value of the variable line and redirecting the standard output of the variable to $file. the current line to file. The latter is not needed for the line count, of course, but demonstrates how to check for success of an operation: the special variable $? will contain the return code from the previous command (the redirected echo). By Unix convention, success is indicated by a return code of 0, all other values are error code with application specific meaning.

Another important issue to consider is that the integer variable, over which iteration is performed should always count down so that the analysis can find a bound. This might require some restructuring of the code, as in the following example, where an explicit counter z is introduced for this purpose. After the loop, the line count and the contents of the last line are printed, using echo. Of course, there is a Linux command that already implements line-count functionality: wc (for word-count) prints, when called with option -l, the number of lines in the file. We use this to check wether our line count is correct, demonstrating numeric operations on the way.

You might be interested in
What should every Software Engineer know about Software Architecture?
Alenkinab [10]
<span>!UML (all of them)
2.Flowchart (more for understanding a real world process of some kind; like a business process)
3.Data model including Bachman (if you don't need to at least understand your data, how it is stored versus a model, i.e., Bachman then you are doing it wrong and your schema could be simplistic)
This is 3 different examples</span>
6 0
3 years ago
The rules of a programming language constitute its__________________
kogti [31]
The rules of a programming language constitute its syntax.
7 0
1 year ago
What process combines data from a list with the content of a document to provide personalized documents?
Andrej [43]
The appropriate answer is d. mail merge. Mail merge uses a database of addresses that are used to create pre-addressed mailing labels that are generally used when sending letters to a very large group. This type of application is used by utility companies or any other organizations that requires mass mailings. Mail merge is found in the Microsoft Word application. Excell spreadsheets can also be used to complete tasks similar to that of mail merge.
8 0
2 years ago
Read 2 more answers
When you save a Notepad file for the first time, you must also A. print a copy for your records. B. give it a name. C. check the
Kruka [31]
Answer: Give it a name
3 0
3 years ago
What method of the String object searches the string for an occurence of the specified search string?
KATRIN_1 [288]

Answer:

the indexOf() method

Explanation:

The indexOf() method in java returns the first occurrence of the of the string or a character specified in it.It can be used to search both a character or a string.

for example:-

import java.util.*;

import java.lang.*;

import java.io.*;

class indexOf

{

public static void main (String[] args)

{

    String s="IamNumber4";

    int l=s.indexOf("Num");//using indexOf() method on string object..

    System.out.println(l);

}

}

Output:-

3

3 0
3 years ago
Other questions:
  • How does the use of modules provide flexibility in a structured programming design?
    14·2 answers
  • "Which of the following will help protect against a brute force attack?
    11·1 answer
  • Choose a film you have watched, or watch a film you have wanted to. Write a film review in at least three paragraphs. Describe w
    5·1 answer
  • With the range E2:E30 selected, create a new conditional formatting rule that uses a formula to apply yellow fill and bold font
    10·1 answer
  • What factor(s) should be considered when determining whether a business is too far based on the query and the user location? Sel
    10·1 answer
  • COMPUTER CODING
    5·1 answer
  • What reforms were made by the British government in India after the war of independence? write any three
    5·1 answer
  • What does it mean to prioritize tasks?
    12·2 answers
  • What is the suffix of hollow?
    7·1 answer
  • How do I cancel and end my brainy subscription?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!