diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2018-12-19 01:51:15 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2018-12-19 01:51:15 -0500 |
| commit | e2d4cea468e1670504a347b7029fc014efdd4d04 (patch) | |
| tree | d52f6a2b30a2471948b5e068683f01e7801a97a1 /mkshrc | |
| parent | 9d045de220bba2da47675a1fb4510a0b940ec5c4 (diff) | |
| download | dotfiles-e2d4cea468e1670504a347b7029fc014efdd4d04.tar.gz dotfiles-e2d4cea468e1670504a347b7029fc014efdd4d04.tar.xz | |
Update the pullkeys shell function, re arranged aliases, etc.
`pullkeys` hasn't changed much. I have added `pullkeys_github` which
takes one argment, that being the apparently case sensitive github
username and pulls down any keys associated to it and installs them.
Diffstat (limited to 'mkshrc')
| -rw-r--r-- | mkshrc | 47 |
1 files changed, 33 insertions, 14 deletions
@@ -126,19 +126,23 @@ fi setaliases() { alias ls="ls -F"; - alias l="ls -lhF"; + alias lt="ls -tF"; alias ll="ls -lhF"; + alias llt="ls -tlhF"; alias g="grep"; - alias m="$PAGER"; + alias m="more"; alias j="jobs"; alias p="pwd"; - alias gdb='gdb -q' - alias bc='bc -q' + alias c="column" + alias ct="column -t" alias eg='egrep' - alias search='egrep -rniI' + alias search='grep -niRIE' alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'" alias setxkbmap-list="man xkeyboard-config" - alias showsshhosts="awk '/^host /{print \$2}' ~/.ssh/config" + alias showsshhosts="awk '/^[hH]ost /{print \$2}' ~/.ssh/config" + alias xa='xargs -d'\n' -I{}' + alias gdb='gdb -q' + alias bc='bc -q' } setcoloraliases() { @@ -373,20 +377,35 @@ pulldotfile() { file="$1" pull -u "${UPDATE_URL}${file}" -f "$HOME/.${file}" } -pullkeys() { - _timestamp="$(timestamp)" - file="keys/$1" +_make_ssh_dir_if_not_exists() { auth_keys="$HOME/.ssh/authorized_keys" - set -x if ! [ -d $HOME/.ssh ] ; then mkdir $HOME/.ssh ; fi chmod 700 $HOME/.ssh chmod 600 $auth_keys +} +_pullkeys() { + url="$1"; shift + _timestamp="$(timestamp)" + _make_ssh_dir_if_not_exists + auth_keys="$HOME/.ssh/authorized_keys" mv "$auth_keys" "${auth_keys}.${_timestamp}" || \ - echo "Authorized Keys do not exist" - pull -u "${UPDATE_URL}${file}" -f "$auth_keys" - ssh-keygen -lf "$auth_keys" || mv "${auth_keys}.${_timestamp}" "$auth_keys" + echo "Authorized Keys do not currently exist" + pull -u "$url" -f "$auth_keys" || \ + mv "${auth_keys}.${_timestamp}" "$auth_keys" + ssh-keygen -lf "$auth_keys" || \ + mv "${auth_keys}.${_timestamp}" "$auth_keys" + chmod 600 $auth_keys - set +x +} +pullkeys() { + file="keys/$1"; shift; + url="${UPDATE_URL}${file}" + _pullkeys "$url" +} +pullkeys_github() { + _username="$1"; shift; + url="https://github.com/${_username}.keys" + _pullkeys "$url" } updatetmuxconf() { pulldotfile "tmux.conf" |
