Added stuff into profile.d-folder, couldn't login afterwards
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
Ok, thank you for information!
Quote:
Originally Posted by hazel
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.
That actually might be it, not 100% certain though, stupid me didn't save that script anywhere when I removed it from profile.d so that I could log in with gui again. Another thing that occurred to me is that I maybe forgot to add #! at the beginning. Could that produce something like this on its own? I find it somewhat confusing that sometimes when I've written something into file it doesn't seem to matter whether for example "!#/bin/bash" is there and file can be executed properly. Is this some kind of automation by something by any chance? I'm currently using emacs as my text editor with hardly any modification of my own, so there might be some kind of newbie mechanic in use?
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
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
So if I have a (bash) thing that's missing it it would be running properly in a bash and any other environment that recognizes notation and anything else would produce errors that produce some sort of message/termination?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.