cyber-patriot/init.sh

35 lines
617 B
Bash

#!/bin/bash
# set internal field separator,
# saving old one
OIFS="$IFS"
IFS=$'\n'
MV="mv"
[[ -d ~/cyber_bin ]] || mkdir ~/cyber_bin
if [[ "$PATH" != *"~/cyber_bin"* ]]; then
# if script not run yet
PATH="$PATH:~/cyber_bin"
fi
for file in $(ls -A1 dot_bash_*); do
newname=$(perl -p -e 's#dot_#.#gmi' <<< "$file")
${MV} "$file" ~/"$newname"
done
${MV} dostuff.sh ~
for file in $(
ls -1 |
egrep -vi \(init\|license\|readme\|git\|dostuff\)
); do
${MV} "$file" -t ~/cyber_bin/
done
# push changes made to PATH
hash -r
source ~/.bash_profile
# reset internal field separator
IFS="$OIFS"