fi
function ssh-forget() {
- sed -i "" "/^$1,/d" ~/.ssh/known_hosts
+ sed -i "" "/^$1[, ]/d" ~/.ssh/known_hosts
}
function ssh-learn() {
- sed -i "" "/^$1,/d" ~/.ssh/known_hosts
+ sed -i "" "/^$1[, ]/d" ~/.ssh/known_hosts
ssh-keyscan -t rsa $1 >> ~/.ssh/known_hosts
}
+
+function canonicalize() {
+ local relpath=$( dirname $1 )
+ if [[ ! -d "$relpath" ]]; then
+ echo "$0: no such file or directory: $1"
+ return 1
+ fi
+
+ echo $(cd $relpath; pwd -P)/$(basename $1)
+ return 0
+}