init comit
parent
10478cfa81
commit
00230fe82e
|
@ -0,0 +1,2 @@
|
|||
alias please='sudo $(fc -ln -1)'
|
||||
alias resource='source ~/.bash_profile'
|
|
@ -0,0 +1,12 @@
|
|||
function mcd {
|
||||
mkdir "$@" && cd $_
|
||||
}
|
||||
|
||||
function rewind {
|
||||
# cheeky hack
|
||||
source rewind.sh "$HISTFILE" "$@"
|
||||
}
|
||||
|
||||
function download {
|
||||
curl "$1" > "$2"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
[ -f ~/.bash_aliases ] && . ~/.bash_aliases
|
||||
[ -f ~/.bash_functions ] && . ~/.bash_functions
|
||||
export PS1='\[\033[0m\]\[\033[1;36m\]\w\[\033[0m\]\n: \$\u@\h; '
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
# set internal field separator,
|
||||
# saving old one
|
||||
OIFS="$IFS"
|
||||
IFS=$'\n'
|
||||
|
||||
MV="mv"
|
||||
LN="ln"
|
||||
|
||||
[[ -d ~/apt_stuff ]] || mkdir ~/apt_stuff
|
||||
|
||||
if [[ "$PATH" != *"~/.cyber_bin"* ]]; then
|
||||
# if script not run yet
|
||||
PATH="$PATH:~/.cyber_bin"
|
||||
mkdir ../.cyber_bin
|
||||
fi
|
||||
|
||||
for file in $(ls -A1 .bash_*); do
|
||||
${MV} "$file" ~
|
||||
done
|
||||
|
||||
for file in $(
|
||||
ls -1 |
|
||||
egrep -vi \(init\|license\|readme\|git\)
|
||||
); do
|
||||
${LN} "$file" "~/.cyber_bin/$file"
|
||||
done
|
||||
|
||||
[[ ! -f ~/.bashrc ]] && ${LN} ~/.bash_profile ~/.bashrc
|
||||
|
||||
# push changes made to PATH
|
||||
hash -r
|
||||
source ~/.bash_profile
|
||||
|
||||
# reset internal field separator
|
||||
IFS="$OIFS"
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
HISTFILE="$1"; shift 1
|
||||
|
||||
if [[ "$1" == "-f" ]]; then
|
||||
# lazy getopt
|
||||
TARGETFUNC="$2"
|
||||
shift 2
|
||||
else
|
||||
TARGETFUNC=
|
||||
fi
|
||||
|
||||
HEADLINES="${1:-1}"
|
||||
FCLINES=$((HEADLINES + 1))
|
||||
|
||||
COMMANDS="$(fc -ln "-${FCLINES}" | head "-${HEADLINES}")"
|
||||
# echo "$COMMANDS"
|
||||
|
||||
if [[ -z "$TARGETFUNC" ]]; then
|
||||
eval "$COMMANDS"
|
||||
else
|
||||
eval "function $TARGETFUNC {
|
||||
$COMMANDS
|
||||
}"
|
||||
fi
|
Loading…
Reference in New Issue