shell scipt

0 Bernard Pyc0d333 Parah · December 15, 2014
please any ideas on how to set a shell script that will play a certain mp3 file when i log in or out of my system..bash shell

Post a Reply

Replies

Oldest  Newest  Rating
0 Bernard Pyc0d333 Parah · December 15, 2014
wow thanks alot Eugene!!!!!!!!!!
+1 Eugene Botma · December 15, 2014
The ~/.bashrc and ~/.bash_profile files are executed when the user logs in (its good practice to use the profile file rather than the rc file, but both work), and ~/.bash_logout is executed when you log out. So just add the line to those two files and you should be set. You might need to make them executable though. Some distros are fussy about that

If you're using Old Shell or Bourne/KSH shell, it doesn't execute the logout script automatically, you need to add the following line to ~/.profile
trap '. $HOME/.my_shell_logout; exit' 0

Ofcourse, replace my_shell_logout with the file name of your new logout script.
0 Bernard Pyc0d333 Parah · December 15, 2014
i want it to happen at login and logout @Eugene.
thanks though
+1 Eugene Botma · December 15, 2014
easiest solution would probably be to add a line to your ~/.bashrc or ~/.bash_profile file that opens a player and plays the song/sound.
  • 1

Shell Scripting

107,162 followers
About

A shell script is a computer program designed to be run by the Unix shell, a command line interpreter. The various dialects of shell scripts are considered to be scripting languages.

Links
Moderators
Bucky Roberts Administrator