DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 28th August 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Default Changing shell to bash

Hello guys,
Few days back I read an article on Bash Vs Tcsh. and according to the author bash is far superior to tcsh. So I decided to gice bash a try.

Now I'm surprised that bash is not installed by default (no problem). I installed it and changed my shell to bash all of the sudden I'm not able to use many of the commands like shutdown.

Can someone tell me what I might have done wrong.
Reply With Quote
  #2   (View Single Post)  
Old 28th August 2008
Weaseal's Avatar
Weaseal Weaseal is offline
Package Pilot
 
Join Date: May 2008
Location: East Coast, US
Posts: 177
Default

How did you install bash? From ports, I hope. How did you change the shell? The best way is with:
Code:
chsh -s bash
When you say you can't use these commands, are they not found, or are you denied from using them? Remember, only root can use system commands.
__________________
FreeBSD addict since 4.2-RELEASE.
My FreeBSD wiki.
Reply With Quote
  #3   (View Single Post)  
Old 29th August 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Default

Yes, I installed bash from ports, and I used
Code:
chsh -s /usr/local/bin/bash
to change my shell.

Commands are not found even as root.
Reply With Quote
  #4   (View Single Post)  
Old 29th August 2008
lumiwa lumiwa is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Default

Quote:
Originally Posted by rex View Post
Yes, I installed bash from ports, and I used
Code:
chsh -s /usr/local/bin/bash
to change my shell.

Commands are not found even as root.
Did you change for root or user or everyone?
Reply With Quote
  #5   (View Single Post)  
Old 29th August 2008
Weaseal's Avatar
Weaseal Weaseal is offline
Package Pilot
 
Join Date: May 2008
Location: East Coast, US
Posts: 177
Default

Can you show us the output of "env"?
__________________
FreeBSD addict since 4.2-RELEASE.
My FreeBSD wiki.
Reply With Quote
  #6   (View Single Post)  
Old 29th August 2008
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

As Weaseal is hinting about, it seems as if your PATH isn't setup properly.. I don't use FreeBSD(or bash, all ksh here), but I kinda assumed they would copy a skeleton .profile over to each users home directory.

Please post the following in code blocks:
$ echo $PATH

Also:
$ set

Thanks..
Reply With Quote
  #7   (View Single Post)  
Old 29th August 2008
Speedy Speedy is offline
Port Guard
 
Join Date: May 2008
Location: Pelican State
Posts: 23
Default

There was a good article about changing the root shell on the old forum. Basically, you do not want to change root shell. Use toor account instead.
Reply With Quote
  #8   (View Single Post)  
Old 29th August 2008
lumiwa lumiwa is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Default

Quote:
Originally Posted by Speedy View Post
There was a good article about changing the root shell on the old forum. Basically, you do not want to change root shell. Use toor account instead.
http://www.bsdforums.org/forums/showthread.php?t=34243

and I think thee are more.
Reply With Quote
  #9   (View Single Post)  
Old 29th August 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Default

hmmm I did a fresh installation yesterday, installed bash and added user with bash as their default shell, so far every thing works fine.
I wonder the problem I faced was because of ~/.bashrc file that I added to change the prompt.

On bash which file should I edit to change the prompt? I like "$" prompt.

Install bash from the port and create user with bash as their shell. Is there any other thing I need to do to get bash working properly?

which shell would you guys suggest for daily use (I don't have X installed) including scripting. I'm not looking for some shell which provides too many fancy features (some basic should be there).

Last edited by rex; 29th August 2008 at 01:49 AM.
Reply With Quote
Old 29th August 2008
BSDKaffee's Avatar
BSDKaffee BSDKaffee is offline
Real Name: Jason Hale
Coffee Addict
 
Join Date: May 2008
Location: Wintersville, Ohio
Posts: 212
Default

Quote:
Originally Posted by rex View Post
I wonder the problem I faced was because of ~/.bashrc file that I added to change the prompt.

On bash which file should I edit to change the prompt? I like "$" prompt.
From the bash(1) manpage:
Quote:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
Personally, I use ~/.bash_profile. ~/.bashrc is not intended for login shells.

Quote:
Originally Posted by rex View Post
Install bash from the port and create user with bash as their shell. Is there any other thing I need to do to get bash working properly?
Not really, other than customization.

Quote:
Originally Posted by rex View Post
which shell would you guys suggest for daily use (I don't have X installed) including scripting. I'm not looking for some shell which provides too many fancy features (some basic should be there).
I use bash because many scripts work with it and does have quite a few features. If you don't want anything too fancy or don't want an extra port installed, then perhaps just stick with /bin/sh or /bin/tcsh (and I'm not saying there's anything wrong with either of those).
Reply With Quote
Old 29th August 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Default

In my home directory I only have .hash_history, no other bash related file. Now what should I do.
Reply With Quote
Old 29th August 2008
BSDKaffee's Avatar
BSDKaffee BSDKaffee is offline
Real Name: Jason Hale
Coffee Addict
 
Join Date: May 2008
Location: Wintersville, Ohio
Posts: 212
Default

They won't be created automatically, you need to do that yourself. I'll give you my very plain ~/.bash_profile as a starting point:
Code:
export BLOCKSIZE=K
export CLICOLOR=yes
export EDITOR=ee
export PAGER=more
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:$HOME/bin
export PS1="[\w]$ "

[ -x /usr/games/fortune ] && /usr/games/fortune freebsd-tips
You could also make a symlink to ~/.profile if you just want to use the profile for sh.

Now for my xterm (Konsole) I use ~/.bashrc:
Code:
export GTK2_RC_FILES=$HOME/.gtkrc-2.0
export MAIL_AGENT=$HOME/src/scripts/sendprkmail.sh

function tranquil_thoughts_prompt
{
local WHITE="\[\033[1;37m\]"
local BRIGHTGREEN="\[\033[1;32m\]"
local GREEN="\[\033[0;32m\]"
local CYAN="\[\033[0;36m\]"

PS1="${WHITE}.oO(${CYAN}\w${WHITE})Oo.${BRIGHTGREEN}\$ "
}

tranquil_thoughts_prompt
Reply With Quote
Old 29th August 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

Quote:
Few days back I read an article on Bash Vs Tcsh. and according to the author bash is far superior to tcsh. So I decided to gice bash a try.
What article did you read?
This one? http://www.insectnation.org/howto/bash-vs-tcsh

It's not an article, it's a stupid rant.

Why do people put this stupid useless fluff on tje web? *sigh*
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Old 29th August 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Default

this is one of them.
Reply With Quote
Reply

Tags
bash, shell

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Good Bash/Scripting book? cwhitmore Programming 10 22nd December 2017 03:59 PM
Changing IDE to SCSI felix001 FreeBSD General 3 19th May 2009 11:52 AM
xterm + bash: Make <DEL> delete char under cursor taylor_venable OpenBSD General 7 13th December 2008 11:53 PM
Is bash included in OpenBSD? bsdnewbie999 OpenBSD General 21 2nd August 2008 02:57 AM
Can't use bash on chroot'd openssh environment jploh FreeBSD General 2 18th June 2008 02:12 AM


All times are GMT. The time now is 05:00 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick