Terminal

Spb18

New Member
Joined
Oct 27, 2020
Messages
1
Reaction score
0
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
Joined
Apr 25, 2017
Messages
1,547
Reaction score
1,218
Credits
2,535
Homework? Assignment?

What have you done so far?
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,317
Reaction score
1,867
Credits
8,257
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!
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top