Arvswitch » History » Version 1
Peter Amstutz, 11/11/2015 04:09 PM
1 | 1 | Peter Amstutz | h1. Arvswitch |
---|---|---|---|
2 | |||
3 | Copy this into your @.bashrc@ or create a new file called something like "arvswitch.sh" and add the line ". arvswitch.sh" to your @.bashrc@ |
||
4 | |||
5 | <pre> |
||
6 | HISTIGNORE=$HISTIGNORE:'export ARVADOS_API_TOKEN=*' |
||
7 | |||
8 | arvswitch() { |
||
9 | if [[ -n "$1" ]] ; then |
||
10 | if [[ -f $HOME/.config/arvados/$1.conf ]] ; then |
||
11 | for a in $(cat $HOME/.config/arvados/$1.conf) ; do export $a ; done |
||
12 | else |
||
13 | echo "$1 unknown" |
||
14 | fi |
||
15 | else |
||
16 | echo "Switch Arvados environment conf" |
||
17 | echo "Usage: arvswitch name" |
||
18 | fi |
||
19 | } |
||
20 | |||
21 | arvlist() { |
||
22 | (cd $HOME/.config/arvados && ls --indicator-style=none *.conf) | rev | cut -c6- | rev |
||
23 | } |
||
24 | |||
25 | arvsave() { |
||
26 | if [[ -n "$1" ]] ; then |
||
27 | env | grep ARVADOS_ > $HOME/.config/arvados/$1.conf |
||
28 | else |
||
29 | echo "Save current Arvados environment variables to conf file" |
||
30 | echo "Usage: arvsave name" |
||
31 | fi |
||
32 | } |
||
33 | |||
34 | arvrm() { |
||
35 | if [[ -n "$1" ]] ; then |
||
36 | if [[ -f $HOME/.config/arvados/$1.conf ]] ; then |
||
37 | rm $HOME/.config/arvados/$1.conf |
||
38 | else |
||
39 | echo "$1 unknown" |
||
40 | fi |
||
41 | else |
||
42 | echo "Delete Arvados environment conf" |
||
43 | echo "Usage: arvrm name" |
||
44 | fi |
||
45 | } |
||
46 | </pre> |