The Gateway to Computer Science Excellence
+3 votes

Which of the following shell scripts will produce the output “my first script”?

  1. for i in my first script { echo –i $i }
  2. for my first script; do echo –n; done
  3. for i in my first script; do echo –i $i; done
  4. for n in my first script; do echo –i $i; done]
in Operating System by Veteran (105k points)
recategorized by | 411 views

1 Answer

+2 votes
ans should be C  

for loop has control variable i which will be assigned he value after it  and do apply for loop to print it should be enclosed in do...done block

echo -i $i display the currrent  contents of i
by Boss (49.3k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,353 answers
105,248 users