Terminal

Spb18

New Member
Credits
11
How to write a shell command that will print out information like the following: "My username is eesa0e and I have been logged in for 403 seconds". Please help with answer!
 


arochester

Moderator
Staff member
Gold Supporter
Credits
2,109
Homework? Assignment?

What have you done so far?
 

JasKinasis

Well-Known Member
Credits
4,000
Hmmm, @Spb18 - In order to facilitate your education, I have three questions for you.
1. What Linux commands can be used to find your username?
2. What Linux commands can be used to find out how long you've been logged in?
3. How do you call a linux command in bash and store its output in a variable?

Your lecturer/professor should already have ran through these with you, if not - perhaps they've left it to you to try to find out for yourself.

If you don't know, try a bit of duckduckgo-fu, or google-fu, or whatever other search engine you prefer and find out the answers to those three questions. Hell, copy and paste them straight into a search engine if you can't be arsed to type! It's really NOT difficult!

Do that, have a play with the commands that are recommended - then try to put those commands together to get the information you need, and use echo to output the required information.

If you have any problems post again with your code and we'll try to help you!
 


Members online


Latest posts

Top