Added stuff into profile.d-folder, couldn't login afterwards
Hello, everyone.
Recently I started using gnu/linux, specifically newest release of Debian (stretch). Some days ago I started to learn about scripting, though for what I've seen it's synonymous with using system to it's fullest potential... Anyway, I'm reading couple tutorial ebooks at the moment and ran into stuff I don't understand. I tried to add a simple script displaying a message upon login, but when I tried to login (into GUI, mind you) it wouldn't let me - screen just reverted back into giving my user password after entering it. What I did was I added simple "greeting.sh"-file into profile.d folder, which had just an echo statement in it. Does more experienced user have an explanation for this behavior? Also some tips for good (free) ebooks about scripting and system in general would be appreciated, I'm not sure if my current reading is doing the trick efficiently enough. Cheers, and thank you! |
If you login with gui, it's preferable to use startup scripts folowing your Desktop environment practices
scripts in /etc/profile.d are meant essentially to set environment (env variables, maybe functions as well) For greeting in console login, there is /etc/issue configuration file as well A simple echo "something" in script shouldn't produce what you describe though, there must be an error somewhere |
You didn't put an exit command at the end of your script, did you? These scripts are "sourced" (i.e. run inside your login shell, not as a separate command), so "exit" will log you out again.
|
Quote:
Quote:
|
It's "#!/bin/bash" (note position of # and !), called "shebang"
Its role is to ensure that bash will interpret this script, say if you start the script from csh shell, the script will stay a bash script thanks to the bash shebang on first line |
Quote:
|
Yes if started from a bash shell, a bash script doesn't need the shebang
|
All times are GMT -5. The time now is 10:37 AM. |