User Tools

Site Tools


bash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
bash [2017/07/01 22:13]
k2patel old revision restored (2013/05/08 17:56)
bash [2019/08/21 17:26] (current)
k2patel
Line 271: Line 271:
 </​code>​ </​code>​
  
 +
 +==== Bash alias and complition ====
 +Using command completion for alias in bash.
 +<code bash ~/​.bash_profile>​
 +alias c='/​usr/​bin/​ssh'​
 +export HLIST
 +HLIST=`cat ~/​.ssh/​known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "​\["​`
 +HLIST="​${HLIST} $(cat ~/​.ssh/​config | grep Host | awk '​{print $2}' | grep -v \*)"
 +HLIST=$(echo ${HLIST} | sort | uniq)
 +complete -W "​${HLIST}"​ c
 +</​code>​
  
 ==== Control case ==== ==== Control case ====
bash.txt ยท Last modified: 2019/08/21 17:26 by k2patel