~/.profile and bash (am I doing it right?)

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

~/.profile and bash (am I doing it right?)

Post by zAchAry »

~/.profile ; ~/.bash_profile ; bash

I've found an archive with a file named 'bash_profile'

page: http://homepages.ihug.co.nz/~trmusson/p ... .html#misc
archive: http://homepages.ihug.co.nz/~trmusson/s ... 218.tar.gz
file: /bashbits-20070218/dot/bash_profile

Eventually I came up with the file '~/.profile' (and it does what I need it to do)

Code: Select all

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# add /usr/sbin/
if [ -d /usr/sbin/ ]; then
    PATH="/usr/sbin/:$PATH"
fi

# add /sbin
if [ -d /sbin ]; then
    PATH="/sbin:$PATH"
fi

# add /sbin games
if [ -d /sbin ]; then
    PATH="$PATH:/sbin"
fi

I've added the following code:

Code: Select all

# add /usr/sbin/
if [ -d /usr/sbin/ ]; then
    PATH="/usr/sbin/:$PATH"
fi

# add /sbin
if [ -d /sbin ]; then
    PATH="/sbin:$PATH"
fi

# add /sbin games
#if [ -d /sbin ]; then
#    PATH="$PATH:/sbin"
#fi
Will that code cause problems?
Is that code redundant?
Is there anything wrong with it?

I need it to use
'slapt-get' instead of '/usr/sbin/slapt-get'
'ifconfig' instead of '/sbin/ifconfig'
I want to use some script located in ~/bin
etc.
Image
Help to make Slackware easier Donate to Salix
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

Re: ~/.profile and bash (am I doing it right?)

Post by zAchAry »

Image
Help to make Slackware easier Donate to Salix
Post Reply