New Member
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!


Staff member
Gold Supporter
Homework? Assignment?

What have you done so far?


Well-Known Member
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!