executing a shell script everytime the terminal is opened

the problem statement is

 	 	 	 	Write 	a shell script, which gets executed the moment the user opens a 	terminal. It should display the message "Hello your_name, 	welcome to 172.16.4.120 server� 

How to get around this?

put the below lines in the .profile or .bashrc file ( under your home directory )

 
echo "Hello $LOGNAME"
echo "Welcome to $HOSTNAME"
1 Like

thanks a lot