Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
wiki:old:customization_tips [2014/08/29 16:29] – [PROMPT BASH for Interactive jobs] bugfix neyronwiki:old:customization_tips [2014/08/29 16:48] – [oarsh completion] neyron
Line 1201: Line 1201:
 ====== Users tips ====== ====== Users tips ======
 ===== oarsh completion ===== ===== oarsh completion =====
-//This tip is from Jerome Reybert.//+//Tip based on an idea from Jerome Reybert//
  
-"I wanted a simple way to access another nodes from the main node of my OAR reservation (ie. to check if library is present on another nodeor to top a process...). Every time I needed this, I had to +In order to complete nodes names in oarsh command, add these lines in your .bashrc
-<code bash> +
- $ cat $OAR_NODEFILE +
- $ oarsh "one of the nodes" +
-</code> +
- +
-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>+
  
 <code bash> <code bash>
- function _oarsh_complete_() +function _oarsh_complete_() { 
- +  if [ -n "$OAR_NODEFILE" -a "$COMP_CWORD" -eq 1 ]; then 
-   local word=${comp_words[comp_cword]} +    local word=${comp_words[comp_cword]} 
-   local list=`cat $OAR_NODEFILE | uniq | tr '\' ' '` +    local list=$(cat $OAR_NODEFILE | uniq | tr '\n' ' ') 
-   COMPREPLY=($(compgen -W "$list" -- "${word}")) +    COMPREPLY=($(compgen -W "$list" -- "${word}")) 
- } +  fi 
- complete -F _oarsh_complete_ oarsh+
 +complete -o default -F _oarsh_complete_ oarsh
 </code> </code>
  
 +Then try oarsh <TAB>
 ===== PROMPT BASH for Interactive jobs ===== ===== PROMPT BASH for Interactive jobs =====
 If you want to have a bash prompt with your job id and the remaining walltime then you can add in your ~/.bashrc: If you want to have a bash prompt with your job id and the remaining walltime then you can add in your ~/.bashrc:
wiki/customization_tips.txt · Last modified: 2020/03/25 15:24 by neyron
Recent changes RSS feed GNU Free Documentation License 1.3 Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki