bash_aliases: move cygwin-specific aliases to bash_aliases.d/cygwin
This commit is contained in:
parent
dab102d24d
commit
e860fabb0f
60
bash_aliases
60
bash_aliases
@ -323,66 +323,6 @@ HISTCONTROL='ignoreboth'
|
||||
HISTSIZE=5000
|
||||
HISTFILESIZE=${HISTSIZE}
|
||||
|
||||
###########################################################################
|
||||
# cygwin-specific
|
||||
###########################################################################
|
||||
if [[ -e /bin/cygwin1.dll ]]; then
|
||||
alias ip="ipconfig | grep -E 'IP(v4)? Address' | sed -e 's/.*: //'"
|
||||
|
||||
function cs
|
||||
{
|
||||
while [[ "$1" != "" ]]
|
||||
do
|
||||
if [[ -e "$1" ]]; then
|
||||
dn=$(dirname "$1")
|
||||
bn=$(basename "$1")
|
||||
(cd "$dn"; HOME='' cygstart "$bn")
|
||||
else
|
||||
HOME='' cygstart "$1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
function winpython
|
||||
{
|
||||
local winpython=/c/Python27/python.exe
|
||||
if [[ "$1" == "" ]]; then
|
||||
${winpython} -i
|
||||
else
|
||||
${winpython} "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
winpath="$(echo $PATH | sed -e 's/:/\n/g' | grep cygdrive | tr '\n' ':' | sed -e 's/:*$//')"
|
||||
|
||||
export SSH_AUTH_SOCK=/tmp/.ssh_socket
|
||||
|
||||
function ssh_agent_start
|
||||
{
|
||||
# cygwin ssh-agent support, from
|
||||
# http://www.webweavertech.com/ovidiu/weblog/archives/000326.html
|
||||
|
||||
ssh-add -l >/dev/null 2>&1
|
||||
|
||||
if [ $? = 2 ]; then
|
||||
# exit status 2 means we couldn't connect to ssh-agent,
|
||||
# so let's start one now
|
||||
rm -f $SSH_AUTH_SOCK
|
||||
ssh-agent -a $SSH_AUTH_SOCK >/tmp/.ssh-script
|
||||
. /tmp/.ssh-script
|
||||
echo $SSH_AGENT_PID >/tmp/.ssh-agent-pid
|
||||
ssh-add ~/.ssh/JoshHoltropGentex
|
||||
fi
|
||||
}
|
||||
|
||||
function ssh_agent_stop
|
||||
{
|
||||
pid=$(cat /tmp/.ssh-agent-pid)
|
||||
kill $pid
|
||||
}
|
||||
fi
|
||||
|
||||
# source any machine-local aliases
|
||||
# this way ~/.bash_aliases can be shared in many places
|
||||
if [ -f ~/.bash_aliases.local ]; then
|
||||
|
59
bash_aliases.d/cygwin
Normal file
59
bash_aliases.d/cygwin
Normal file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -e /bin/cygwin1.dll ]]; then
|
||||
alias ip="ipconfig | grep -E 'IP(v4)? Address' | sed -e 's/.*: //'"
|
||||
|
||||
# o: "open" files as if double-clicked in Windows explorer
|
||||
function o
|
||||
{
|
||||
while [[ "$1" != "" ]]
|
||||
do
|
||||
if [[ -e "$1" ]]; then
|
||||
dn=$(dirname "$1")
|
||||
bn=$(basename "$1")
|
||||
(cd "$dn"; HOME='' cygstart "$bn")
|
||||
else
|
||||
HOME='' cygstart "$1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
function winpython
|
||||
{
|
||||
local winpython=/c/Python27/python.exe
|
||||
if [[ "$1" == "" ]]; then
|
||||
${winpython} -i
|
||||
else
|
||||
${winpython} "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
winpath="$(echo $PATH | sed -e 's/:/\n/g' | grep cygdrive | tr '\n' ':' | sed -e 's/:*$//')"
|
||||
|
||||
export SSH_AUTH_SOCK=/tmp/.ssh_socket
|
||||
|
||||
function ssh_agent_start
|
||||
{
|
||||
# cygwin ssh-agent support, from
|
||||
# http://www.webweavertech.com/ovidiu/weblog/archives/000326.html
|
||||
|
||||
ssh-add -l >/dev/null 2>&1
|
||||
|
||||
if [ $? = 2 ]; then
|
||||
# exit status 2 means we couldn't connect to ssh-agent,
|
||||
# so let's start one now
|
||||
rm -f $SSH_AUTH_SOCK
|
||||
ssh-agent -a $SSH_AUTH_SOCK >/tmp/.ssh-script
|
||||
. /tmp/.ssh-script
|
||||
echo $SSH_AGENT_PID >/tmp/.ssh-agent-pid
|
||||
ssh-add ~/.ssh/JoshHoltropGentex
|
||||
fi
|
||||
}
|
||||
|
||||
function ssh_agent_stop
|
||||
{
|
||||
pid=$(cat /tmp/.ssh-agent-pid)
|
||||
kill $pid
|
||||
}
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user