From the course: Learning Linux Shell Scripting

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Display a variable

Solution: Display a variable - Linux Tutorial

From the course: Learning Linux Shell Scripting

Start my 1-month free trial

Solution: Display a variable

- [Instructor] Hopefully this wasn't too difficult. Here is my solution to the challenge. We do a touch env.sh, change mode 755 env.sh and finally, atom env.sh. Enter the shebang, usr/bin/env bash and print out our one long sentence, echo the computer's name is $HOSTNAME, the user's name is $USER and the home directory is $HOME and then we do an exit 0 and do a control S to save. Go back to the terminal, /env.sh and we get the computer's name, the user's name and the home directory and that's it for that challenge.

Contents