Skip to content

Instantly share code, notes, and snippets.

@mv
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mv/8738f83801d9b3095414 to your computer and use it in GitHub Desktop.
Save mv/8738f83801d9b3095414 to your computer and use it in GitHub Desktop.
cat > /etc/profile <<'EOF'
# /etc/profile
# System wide environment and startup programs, for login setup
# (look for functions and aliases in /etc/bashrc)
##
## ferreira.mv@gmail.com:
##
## /etc/profile does only the following:
## - environment variables: PATH, USER, MAIL, HOSTNAME, etc...
## - source other scripts from /etc/profile.d/*.sh
##
# more details: fqdn, full path, and an empty line to type
export PS1='\u@\H:\w\n\$ '
# better trace for 'set -x'
export PS4="+ \${BASH_SOURCE} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO}> "
# troubleshooting aide:
[ -f /etc/.env-verbose ] && echo "# Inside /etc/profile: [$0]"
[ -f /etc/.env-debug ] && set -x
# classical stuff:
if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`id -u`
UID=`id -ru`
GID=`id -rg`
fi
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
HOSTNAME=$( /usr/bin/hostname 2>/dev/null )
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ]
then HISTCONTROL=ignoreboth
else HISTCONTROL=ignoredups
fi
# Path is the same for any user
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
# No core files by default
#ulimit -S -c 0 > /dev/null 2>&1
# environment
umask 002
for f in /etc/profile.d/*.sh
do
if [ -r "$f" ]
then
[ -f /etc/.env-verbose ] && echo "# /etc/profile: calling [$f]"
. "$f" >/dev/null
else
[ -f /etc/.env-verbose ] && echo "# /etc/profile: ignoring [$f]"
fi
done
unset f
# vim:ts=4:sw=4:ft=sh:
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment