39 lines
716 B
Bash
Executable File
39 lines
716 B
Bash
Executable File
#!/bin/bash
|
|
# ./set_header.sh
|
|
|
|
set -e
|
|
|
|
DOMAIN=$DOMAIN-student.42lausanne.ch}
|
|
MAIL=${MAIL-${USER}@${DOMAIN}}
|
|
|
|
# Add stdheader to vim plugins
|
|
test -d ~/.vim/plugin || mkdir -p ~/.vim/plugin
|
|
cp vim/stdheader.vim ~/.vim/plugin/
|
|
|
|
# Set variables
|
|
if test -f ~/.zshrc
|
|
then
|
|
if ! grep -q ' USER=' ~/.zshrc && [ -z "$USER" ]
|
|
then
|
|
echo 'export USER=`whoami`' >> ~/.zshrc
|
|
fi
|
|
if ! grep -q ' MAIL=' ~/.zshrc
|
|
then
|
|
echo "export MAIL=\"${MAIL}\"" >> ~/.zshrc
|
|
fi
|
|
source ~/.zshrc
|
|
fi
|
|
if test -f ~/.bashrc
|
|
then
|
|
if ! grep -q ' USER=' ~/.bashrc && [ -z "$USER" ]
|
|
then
|
|
echo 'export USER=`whoami`' >> ~/.bashrc
|
|
fi
|
|
if ! grep -q ' MAIL=' ~/.bashrc
|
|
then
|
|
echo "export MAIL=\"${MAIL}\"" >> ~/.bashrc
|
|
fi
|
|
source ~/.bashrc
|
|
fi
|
|
|