Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
View Poll Results: What is your preferred Linux login shell?
I will leave bash on the production systems at work, though, as I'm not the only one who uses them.
You can happily have more than one shell installed and decide on a per-user basis which one to use.
Quote:
________________________
Slackware 14.0 (CLI), Linux Mint 13 MATE, Windows 7, Windows XP, and Windows 2000 at work
Kubuntu 12.04.4 and Windows 7 dual-booting on the laptop
MEPIS 11.0 on the home desktop (soon to become Linux Mint 17 KDE) dual-booting with Windows 7
PiBang v.20131119 (CLI) on the Raspberry Pi old model B (256 MB RAM)
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Quote:
Originally Posted by Myk267
ksh seems like the unholy child of shell and a general purpose programming language.
All shell programs are Command and Programming Languages -- from sh to ksh to base, that's what they are: you execute commands and you can write useful programs in the shell. That would also include derivatives of C-Shell (which is NOT the same thing as Bourne, Korn or BASH, it came out of Berkeley and is distinctive by its convoluted grammar and syntax).
BASH (Bourne Again Shell) is a combination of sh and ksh (the functionality, not the underlying code) with some "extensions" and "features" thrown in. Generally, BASH will run sh and ksh code without too much arguing -- not everything, but pretty much. The grammar and syntax of BASH and KornShell are close enough that you program in the one and run in the other if you're not using BASH extensions (which neither Bourne or KornShell have).
As to user shell preference, it is quite simple to change the 7th field of the user entry in /etc/passwd (optional user command interpreter). This can be done by direct edit of the file (as root) or with usermod -s /bin/shell_name USERNAME (also as root).
A typical user account line looks like this:
Code:
trona:x:1000:100:,,,:/home/trona:/bin/ksh
In the example the optional user command interpreter is KornShell. That could be changed to BASH with
Code:
usermod -s /bin/bash USERNAME
It could also be changed to lock out any log in with
Code:
usermod -s /bin/false USERNAME
You may have noticed if you've looked at /etc/passwd that all of the administrative accounts (except root listed are /bin/false; i.e., you cannot log in to those accounts (attempts will result in immediate exit).
So, anyway, shells are pretty much command interpreters that let you execute commands and write useful programs.
Hope this helps some.
Last edited by tronayne; 07-17-2014 at 12:31 PM.
Reason: Removed erroronous info regarding logging in to a /bin/false account
You can happily have more than one shell installed and decide on a per-user basis which one to use.
...
A better place for this would be your signature.
Two good points, thank you.
If I get to play around enough with zsh on the RasPi to become proficient, I'll change my login shell on the Slackware box per tronayne's information (but not until then <grin>).
You may have noticed if you've looked at /etc/passwd that all of the administrative accounts (except root listed are /bin/false; i.e., you cannot log in to those accounts but you can become that user with su - account_name as root. However, there rarely if ever is any excuse for doing so.
Well, you can't su to a user with /bin/false, or yes, technically you can, but the user's shell starts, and if it's /bin/false, exits immediately ( without reading a single command from the terminal )...
Normally the user's shell should listed in /etc/shells, that is checked by the pam_shells module, but the /bin/false exits right after the invocation so that is not too usuable.
Oh, an by the way, if it's allowed, a user can change hisown shell with the chsh command.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Quote:
Originally Posted by derive
Well, you can't su to a user with /bin/false, or yes, technically you can, but the user's shell starts, and if it's /bin/false, exits immediately ( without reading a single command from the terminal )...
Normally the user's shell should listed in /etc/shells, that is checked by the pam_shells module, but the /bin/false exits right after the invocation so that is not too usuable.
Oh, an by the way, if it's allowed, a user can change hisown shell with the chsh command.
Oops! Yes, /bin/false exits immediately, duh. A little confused about admin accounts where there is a shell specified (when I've been naughty and done such a silly thing).
About PAM. PAM is not installed by default on Slackware systems -- it's available if needed at Slackbuilds.org but its use is discouraged unless absolutely, positively you must have it for something or other..
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
A lot of reasons, actually. There is a current thread about PAM and Slackware you may find interesting, a particular post being http://www.linuxquestions.org/questi...ml#post5205085 although the entire thread may be of interest.
Make sure the backslash character is the LAST character ...
Quote:
Originally Posted by Gullible Jones
No. I may come back to this later, but right now I'd rather have a shell that just worked.
Edit: actually this is more interesting than I thought; I thought it was undocumented shell option behavior, but it did not go away when I reset the shell options to defaults. Scary. I had better look into it.
Thanks.
Make sure the blackslash character is the last character on the line before the <lf>. It is an escape character.
This line "this is a single line \A" will output the line "this is a single line A".
This "some shell command line \ <lf>" will result in the space character after the backslash being kept and the newline will be treated as the end of the line. The line output would be "some shell command line <lf>".
For the line to be continued you need to ensure it is "text of the line \<newline>". And if the shell script line ends with "\<cr><lf>" it might cause a problem as well.
Any time I run into this problem I immediately check for trailing space characters and I inevitable find one or more.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.