Date: Sun, 15 Oct 2000 14:48:05 -0500 (CDT) From: Mike Meyer <mwm@mired.org> To: media@ct1.nai.net Cc: questions@freebsd.org Subject: Re: changing root shell?? Message-ID: <14826.2549.212035.934524@guru.mired.org> In-Reply-To: <28250796@toto.iv>
next in thread | previous in thread | raw e-mail | index | archive | help
media@ct1.nai.net writes: > >> I've been entering commands with sh syntax all along. I haven't > >> received any syntax errors. Does this mean I could have trashed my > >> system without knowing it?? > >The odds are very very slim, especially considering that you received > >no syntax errors that you have damaged your system at all. > Whew!! Thanx :) It still amazes me that I haven't received any syntax > errors, since afaik, sh and csh use very different syntax. I've also > noticed some scripts are written in sh and some are written in csh -- how > does the system know what to do?? First, the only syntax difference you're liable to run into doing simple command lines is redirecting standard error. If you tend to set shell variables at the keyboard, that will get you. Second, if you try invoking csh on an sh script (or vice versa), you will almost certainly get errors. After all, you set variables with a different syntax between the two shells. However, the two are just interpreters to the system. It distinguishes them the same way it distinguishes perl, python, tcl or ruby scripts. > Actually, _The Complete FreeBSD_ and _The FreeBSD handbook_ do make that > clear. Even sysinstall suggests creating another account besides root for > regular use. Regardless, I am doing sys admin duties (eg. trying to get my > printer to work). What I think FreeBSD should make clear, is which shell > is being used by root when you first install it. The welcome message > should say "Listen you clueless newbie, root starts with the csh shell even > though every other Unix system in your life has started with sh unless you > changed it" or something similar :) Well, you could equally well wonder why other Unix variants don't say the same thing about their shells. The answer is that you should have two kinds of people doing things as root: first time sysadmins, who should know they don't know what's going on and check things like that, and experienced sysadmins, who should be cluefull enough to realize that they've just changed systems, and check for such differences. > >You've got bash and relatives right. You might note that the actual > >sequence for many things is VISUAL (if set), the EDITOR. This is true > >for vipw, even though the man page doesn't mention it. The idea was > >that you would get VISUAL if your termain could support a visual > >editor, otherwise EDITOR. For bash, you can add that .profile, and > >other things will inherit it. > I don't understand. What is VISUAL?? A shell variable, just like EDITOR. > How do I remake the password db?? Use the standard tools for editing the password file - passwd, vipw, chsh, adduser, etc. - and they will do it for you before they exit. > >> My tcsh is in /usr/local/bin/tcsh, which wouldn't work in > >>single user mode. > >That's bad. All files that are integral to the system (ie, required > >for the system to boot in single user mode for rescue, recovery, > >etc) should be in the root filesystem. > sh and csh are in /bin and part of the FreeBSD install. I added tcsh and > bash on my own, so they are in /usr/local/bin The change to tcsh (as /bin/csh) is recent; older systems won't do that. > >Edit /etc/passwd and change the /bin/sh or /bin/csh or what-have-you to > >whatever you want your shell to be. > I used chsh -s to change my root to sh, and myself as user (the guy who > reads the man pages :) as bash. This is the better way. > >vi is a superior editor, it just takes some getting used to. Once you > >master the commands, editing with vi is quicker than any other editor out > >there. > I need an editor I can use right now to get my system configured, and many > commands (eg. chsh) automatically call up vi. I'd like to spend less time > in man vi, and more time getting things done. As suggested, set EDITOR (or VISUAL) and use that. Of course, you should know an editor that's on the root file system for the same reasons that you need to know a shell that's on the root file system. That meand ed. > Some commands call up a default editor. I don't have pico and have no > intention of going back to pine (maybe I'll try mutt, I'm using Eudora Pro > on my LEM now -- I know you are mostly PC guys, but 040/7.6.1 is a rock). > Imho, using emacs without X is silly (no flames, please) and wouldn't want > to use X if I were fixing a problem as root. I'd like to set it to ee. Any application that runs on Unix and doesn't obey at least EDITOR needs to be fixed. Set the variable. As for emacs without X - I switched to emacs because it would let me display multiple files at one time. Vi wouldn't do that at the time, and the argument against adding it was that everyone was going to have windowing systems, so you should just open another window. From that perspective, emacs is one of the few visual editors that it isn't silly to run without X. <mike To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14826.2549.212035.934524>