My Exam Question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting My Exam Question
# 1  
Old 01-30-2017
My Exam Question

Hello My friends,

This is my new Thread and i am so newbie about Bash/shell code.

My first exam question is : there is a file (name is also File) and this file has 2 letters and 1 number. And number is in the middle. like this
a
2
c

I have to show only number on screen. And i did like this :

Code:
cat file | tail -n1 | head -n2

and i can see on my screen "2"

the next question is (it continues) : I have to SUM this number with shell code

and i created new kate file and name is total and wrote there :

Code:
c = cat file | tail -n1 | head -n2 

echo $total `expr $c + $c`

but i get "expr :syntax error" ?

How can i sum this number ?

thanks for your helps. Hope so i could explain myself.
# 2  
Old 01-30-2017
Welcome!
Unless you can explain this is not in reference with a class, this thread is closed, you are to post here:
https://www.unix.com/homework-and-coursework-questions/

So I ask you kindly to repost there...

the requirements are not options...
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Solaris

New User Login Exam Question

Hi Folks, I am studying for my 1z0-821 exam and I would like to clarify an answer to the following question : You have a ticket from a new user on the system, indicating that he cannot log in to his account. The information in the ticket gives you both the username and password. The ticket... (2 Replies)
Discussion started by: Ravneet_Pal
2 Replies

2. Solaris

Question about exam

Hello guys I hope you well and in great health, i wonder if i want to get Solaris 11 (1z0-821) exam i've to talk a course in oracle or i can just register for the exam and take it. thanks. (1 Reply)
Discussion started by: mohamed91
1 Replies

3. UNIX for Advanced & Expert Users

HP-UX CSA Exam

Hey All, I have bought some paper from the net... let's say in PDF format. They are some questions from that paper that says Explanation: pending. Send your suggestion tofeedback*****king.com ... anyway. Here are the questions. I have made my choice but would like to know your opinion. 1. The... (1 Reply)
Discussion started by: qfwfq
1 Replies

4. UNIX for Dummies Questions & Answers

HELP for Simple exam

Can you help me to know the commands for these problems? 1. Count the no. of users that are currently logged into the system. 2. Count the no. of lines in /etc/passwd that contains the pattern home. 3. Modify Question #2 so that you save all entries from /etc/passwd that contain the... (1 Reply)
Discussion started by: mhos_mhos
1 Replies
Login or Register to Ask a Question