![]() |
Optware.Bash HistoryHide minor edits - Show changes to markup October 23, 2008, at 03:22 PM
by --
Added line 407:
See http://www.nslu2-linux.org/wiki/HowTo/RunAnotherShellForRootSafely for changing the root shell safely. September 23, 2006, at 12:48 PM
by -- Moved the example .bash_profile to the Example files section and gave it the same styling as the other example files
Changed lines 25-26 from:
The .bash_profile is used during login. to:
The .bash_profile is used during login. This file calls the .bashrc file. Changed lines 35-40 from:
to:
Example filesThese example files are severely cut down versions of the common standard bashrc files (http://www.tldp.org/LDP/abs/html/sample-bashrc.html#BASHRC) which work on the slug. The originals are a lot more sophisticated, but these are a pretty good starting point. Changed lines 43-52 from:
[ -f .bashrc ] && source .bashrc Example filesThese example files are severely cut down versions of the common standard bashrc files (http://www.tldp.org/LDP/abs/html/sample-bashrc.html#BASHRC) which work on the slug. The originals are a lot more sophisticated, but these are a pretty good starting point. Example Global bashrcSave this file as /opt/etc/bashrc to:
Save this file as .bash_profile in the user's home folder (i.e. ~/) Changed line 50 from:
to:
Deleted lines 51-54:
Changed lines 54-81 from:
to:
[ -f .bashrc ] && source .bashrc =] (:tableend:) Example Global bashrcSave this file as /opt/etc/bashrc (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) [=
September 22, 2006, at 02:12 PM
by --
Changed line 131 from:
=============================================================== to:
December 07, 2005, at 06:59 AM
by --
Deleted line 371:
Added lines 374-380:
An issue related to no sftp login with the above ~/.bashrc file. This is caused by an interactive logon starting. My solution is to not parse the ~/.bashrc if the login is not interactive. Adding the line below to the beginning of the ~/.bashrc works for me.
October 30, 2005, at 02:55 PM
by -- problems with line wrapping, incl. solution
Added lines 372-380:
I had some line wrapping problems with this color prompt. putting \[ and \] around the color codes within the prompt definition solved that problem:
to
September 17, 2005, at 11:13 PM
by -- Adding solution
Added lines 369-371:
OK here is the solution: The above problem was caused by the echo statements in the ~/.bshrc file. When all of these were commented out, the sftp logon works now. September 17, 2005, at 05:39 PM
by --
Changed lines 364-368 from:
I had sftp and ssh available before installing and configuring bash for root. After install I cannot do sftp [but can ssh]. When starting my sftp client, I get the error: File transfer sercer could not be started or exited unexpectedly. Exit value 0 was returned. Most likely the sftp-server is not in the pat of the user on the server-side. I maually added the /opt/libexec to to the path, but this did not change the error. I can still sftp and ssh as another user which does not have the .bash configured. to:
I had sftp and ssh available before installing and configuring bash for root. After install I cannot do sftp [but can ssh]. When starting my sftp client, I get the error: File transfer server could not be started or exited unexpectedly. Exit value 0 was returned. Most likely the sftp-server is not in the pat of the user on the server-side. Since then, I maually added the /opt/libexec to to the PATH in /etc/profile, but this did not change the error. BTW, I can still sftp and ssh as another user which does not have the .bash configured. September 17, 2005, at 05:23 PM
by -- ssh ftp not availiable after bash install
Changed lines 362-364 from:
I did a fresh install and did not get a libcurses error. to:
I did a fresh install and did not get a libcurses error. I had sftp and ssh available before installing and configuring bash for root. After install I cannot do sftp [but can ssh]. When starting my sftp client, I get the error: File transfer sercer could not be started or exited unexpectedly. Exit value 0 was returned. Most likely the sftp-server is not in the pat of the user on the server-side. I maually added the /opt/libexec to to the path, but this did not change the error. I can still sftp and ssh as another user which does not have the .bash configured. August 05, 2005, at 06:01 PM
by -- answering questions
Changed lines 358-362 from:
to:
I did a fresh install and did not get a libcurses error. July 28, 2005, at 10:51 AM
by --
Changed lines 171-179 from:
echo -e "${CYAN}BASH ${RED}${BASH_VERSION%.*}$NC" echo -e "\n${RED}Machine information:$NC " ; uname -a
echo -e "\n${RED}Current date :$NC " ; date echo -e "\n${RED}Machine stats :$NC " ; uptime echo -e "\n${RED}Memory stats :$NC " ; free my_ip 2>&- ; echo -e "\n${RED}Free Disk Space :$NC" ; df echo to:
July 28, 2005, at 10:40 AM
by -- Added sample bashrc files
Changed lines 40-123 from:
to:
Example filesThese example files are severely cut down versions of the common standard bashrc files (http://www.tldp.org/LDP/abs/html/sample-bashrc.html#BASHRC) which work on the slug. The originals are a lot more sophisticated, but these are a pretty good starting point. Example Global bashrcSave this file as /opt/etc/bashrc (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:)
#===============================================================
#
# GLOBAL /opt/etc/bashrc FILE for bash-2.05a (or later)
#
# This file is read (normally) by interactive shells only.
# Here is the place to define your aliases, functions and
# other features common to all user's bash sessions.
#
#===============================================================
#-------------------------------------------------------------
# Automatic setting of $DISPLAY (if not set already)
# This works for linux - your mileage may vary....
# The problem is that different types of terminals give
# different answers to 'who am i'......
# I have not found a 'universal' method yet
#-------------------------------------------------------------
DISPLAY=${hostname}:0.0
export DISPLAY
#---------------
# Some settings
#---------------
ulimit -S -c 0 # Don't want any coredumps
set -o notify
set -o noclobber
set -o ignoreeof
set -o nounset
#set -o xtrace # useful for debuging
# Enable options:
shopt -s cdspell
shopt -s cdable_vars
shopt -s checkhash
shopt -s checkwinsize
shopt -s mailwarn
shopt -s sourcepath
shopt -s no_empty_cmd_completion # bash>=2.04 only
shopt -s cmdhist
shopt -s histappend histreedit histverify
shopt -s extglob # necessary for programmable completion
# Disable options:
# shopt -u mailwarn
# unset MAILCHECK # I don't want my shell to warn me of incoming mail
export TIMEFORMAT=$'\nreal %3R\tuser %3U\tsys %3S\tpcpu %P\n'
export HISTIGNORE="&:bg:fg:ll:h"
export HOSTFILE=$HOME/.hosts # Put a list of remote hosts in ~/.hosts
#-----------------------
# Greeting, motd etc...
#-----------------------
# Define some colors first:
red='\e[0;31m'
RED='\e[1;31m'
blue='\e[0;34m'
BLUE='\e[1;34m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
NC='\e[0m' # No Color
# --> Nice. Has the same effect as using "ansi.sys" in DOS.
(:tableend:) Changed lines 126-127 from:
See http://www.tldp.org/LDP/abs/html/sample-bashrc.html#BASHRC for a excellent example. Warning: this is not directly usable for the slug! to:
Save this file as .bashrc in any normal user's home folder (i.e. ~/) it relies on the existence of the /opt/etc/bashrc file. (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:)
===============================================================
#
# PERSONAL $HOME/.bashrc FILE for bash-2.05a (or later)
#
# Last modified: Mon Jan 17
#
# This file is read (normally) by interactive shells only.
# Here is the place to define your aliases, functions and
# other interactive features like your prompt.
#
# This file was designed (originally) for Solaris but based
# on Redhat's default .bashrc file
# --> Modified for Linux.
# The majority of the code you'll find here is based on code found
# on Usenet (or internet).
# This bashrc file is a bit overcrowded - remember it is just
# just an example. Tailor it to your needs
# --> Tailored to be operable on the NLSU2 with Unslung 1.x
# onwards. It has been cut down somewhat from the original
# sample found at:
# http://www.tldp.org/LDP/abs/html/sample-bashrc.html#BASHRC
#
#===============================================================
#-----------------------------------
# Source global definitions (if any)
#-----------------------------------
if [ -f /opt/etc/bashrc ]; then
. /opt/etc/bashrc # --> Read /opt/etc/bashrc, if present.
fi
#-----------------------
# Greeting, motd etc...
#-----------------------
# Define some colors first (defined in /opt/etc/bashrc):
# Looks best on a black background.....
echo -e "${CYAN}BASH ${RED}${BASH_VERSION%.*}$NC"
echo -e "\n${RED}Machine information:$NC " ; uname -a
#echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Memory stats :$NC " ; free my_ip 2>&- ;
echo -e "\n${RED}Free Disk Space :$NC" ; df
echo
# function to run upon exit of shell
#function _exit()
#{
# echo -e "${RED}Bye Bye${NC}"
#}
#trap _exit EXIT
#---------------
# Shell Prompt
#---------------
HILIT=${cyan} # local machine: prompt will be partly cyan
# --> Replace instances of \W with \w in prompt functions below
# --> to get display of full path name.
function fastprompt()
{
unset PROMPT_COMMAND
case $TERM in
*term | rxvt | linux )
PS1="${HILIT}//\h\w$NC> " ;;
*)
PS1="//\h\w> " ;;
esac
}
fastprompt
#-----------------------------------
# File & strings related functions:
#-----------------------------------
# Find a file with a pattern in name:
function ff() { find . -type f -iname '*'$*'*' -ls ; }
# Find a file with pattern $1 in name and Execute $2 on it:
function fe() { find . -type f -iname '*'$1'*' -exec "${2:-file}" {}\; ; }
function ii() # get current host related info
{
echo -e "\nYou are logged on ${RED}$HOST"
echo -e "\nAdditionnal information:$NC " ; uname -a
# echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Memory stats :$NC " ; free my_ip 2>&- ;
echo -e "\n${RED}Local IP Address :$NC" ; echo ${MY_IP:-"Not connected"}
echo -e "\n${RED}ISP Address :$NC" ; echo ${MY_ISP:-"Not connected"}
echo -e "\n${RED}Free Disk Space :$NC" ; df
echo
}
(:tableend:) Example .bashrc for rootSave this file as .bashrc in the root user's home folder (i.e. /root/) it relies on the existence of the /opt/etc/bashrc file. (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:)
#===============================================================
#
# PERSONAL $HOME/.bashrc FILE for bash-2.05a (or later)
#
# Last modified: Mon Jan 17
#
# This file is read (normally) by interactive shells only.
# Here is the place to define your aliases, functions and
# other interactive features like your prompt.
#
# This file was designed (originally) for Solaris but based
# on Redhat's default .bashrc file
# --> Modified for Linux.
# The majority of the code you'll find here is based on code found
# on Usenet (or internet).
# This bashrc file is a bit overcrowded - remember it is just
# just an example. Tailor it to your needs
# --> Tailored to be operable on the NLSU2 with Unslung 1.x
# onwards. It has been cut down somewhat from the original
# sample found at:
# http://www.tldp.org/LDP/abs/html/sample-bashrc.html#BASHRC
#
#===============================================================
#-----------------------------------
# Source global definitions (if any)
#-----------------------------------
if [ -f /opt/etc/bashrc ]; then
. /opt/etc/bashrc # --> Read /opt/etc/bashrc, if present.
fi
#-----------------------
# Greeting, motd etc...
#-----------------------
# Define some colors first (defined in /opt/etc/bashrc):
# Looks best on a black background.....
echo -e "${CYAN}BASH ${RED}${BASH_VERSION%.*}$NC"
echo -e "\n${RED}Machine information:$NC " ; uname -a
#echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Memory stats :$NC " ; free my_ip 2>&- ;
echo -e "\n${RED}Free Disk Space :$NC" ; df
echo
# function to run upon exit of shell
#function _exit()
#{
# echo -e "${RED}Bye Bye${NC}"
#}
#trap _exit EXIT
#---------------
# Shell Prompt
#---------------
HILIT=${RED} # local machine: prompt will be partly red
# --> Replace instances of \W with \w in prompt functions below
# --> to get display of full path name.
function fastprompt()
{
unset PROMPT_COMMAND
case $TERM in
*term | rxvt | linux )
PS1="${HILIT}//\h\w$NC# " ;;
*)
PS1="//\h\w# " ;;
esac
}
fastprompt
#-----------------------------------
# File & strings related functions:
#-----------------------------------
# Find a file with a pattern in name:
function ff() { find . -type f -iname '*'$*'*' -ls ; }
# Find a file with pattern $1 in name and Execute $2 on it:
function fe() { find . -type f -iname '*'$1'*' -exec "${2:-file}" {}\; ; }
function ii() # get current host related info
{
echo -e "\nYou are logged on ${RED}$HOST"
echo -e "\nAdditionnal information:$NC " ; uname -a
# echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Memory stats :$NC " ; free my_ip 2>&- ;
echo -e "\n${RED}Local IP Address :$NC" ; echo ${MY_IP:-"Not connected"}
echo -e "\n${RED}ISP Address :$NC" ; echo ${MY_ISP:-"Not connected"}
echo -e "\n${RED}Free Disk Space :$NC" ; df
echo
}
(:tableend:) Added line 365:
June 04, 2005, at 03:02 PM
by -- link to /opt/etc/profile
Changed lines 30-35 from:
to:
This package comes with /opt/etc/profile. Use ln -s /opt/etc/profile /etc/profile to activate it. May 25, 2005, at 05:51 AM
by -- prompt example added
Changed lines 41-42 from:
Look at: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO to:
A simple prompt (SuSE-style):export PS1="\u@\h:\w/ > " export PS2="> " For details: look at: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO April 18, 2005, at 12:16 PM
by -- Split the error message so it wraps now.
Changed lines 48-50 from:
to:
April 17, 2005, at 07:45 PM
by --
Added lines 50-53:
////Note to maintainer:
It might be helpful to noobies to include that the January 25, 2005, at 12:01 PM
by --
Added lines 40-43:
The PromptLook at: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO January 14, 2005, at 08:25 PM
by --
Changed lines 38-45 from:
See http://www.tldp.org/LDP/abs/html/sample-bashrc.html#BASHRC for a excellent example. Warning: this is not directly usable for the slug! to:
See http://www.tldp.org/LDP/abs/html/sample-bashrc.html#BASHRC for a excellent example. Warning: this is not directly usable for the slug! ////Note to maintainer: It seems like bash needs curses, after installing bash and ssh on a fresh 3.17 I got this error when starting bash.
January 11, 2005, at 01:06 AM
by --
Changed line 11 from:
echo "bash" >> /etc/shells to:
echo "/opt/bin/bash" >> /etc/shells January 07, 2005, at 11:40 AM
by --
Added lines 29-30:
During login the /etc/profile will also be executed (if it exists). January 07, 2005, at 11:37 AM
by --
Changed lines 1-36 from:
Describe {{Bash}} here. to:
InstallationFrom the root prompt, type: ipkg install bash ConfigurationThe /etc/shellsYou can add bash to the /etc/shells file. Just simple do: echo "bash" >> /etc/shells The /etc/passwd fileYou can configure the default shell for a normal user: - Open the /etc/passwd file - Change the line of the normal user (myuser): myuser:*crypted*:2000:501:Normal User:/share/hdd/data/myuser:/opt/bin/bash First loginTry now to login as the normal user. The .bash_profile and .bashrc filesThe .bash_profile is used during login. The .bashrc is called when a bash process is started (not login) Example .bash_profile[ -f .bashrc ] && source .bashrc Example .bashrcSee http://www.tldp.org/LDP/abs/html/sample-bashrc.html#BASHRC for a excellent example. Warning: this is not directly usable for the slug!
view ·
edit ·
print ·
history ·
Last edited by RalphFinch.
Based on work by Tobbe, Serge Rijkers, Sebastian Meiss, Chacko, Mark, MattMcNeill, HF Manson, Dietmar Zlabinger, tman, Dutch at nyquist-plot dot com, perlguru, RickardDahlstrand, and scott. Originally by perlguru. Page last modified on October 23, 2008, at 03:22 PM
|