Oarsh and bash completion

From WikiOAR

Jump to: navigation, search

Tip from Jerome Reybert

I wanted a simple way to access another nodes from the main node of my OAR reservation (ie. to check if a library is present on another node, or to top a process...). Every time I needed this, I had to


$ cat $OAR_NODEFILE
$ oarsh "one of the nodes"

bash_completion is a better solution. bash_completion seems to be widely available on g5k nodes. You just have to add these lines in your .bashrc, and then try oarsh <TAB>:

function _oarsh_complete_()
{
  local word=${COMP_WORDS[COMP_CWORD]}
  local list=`cat $OAR_NODEFILE | uniq | tr '\n' ' '`
  COMPREPLY=($(compgen -W "$list" -- "${word}"))
}
complete -F _oarsh_complete_ oarsh
Personal tools