Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is my bash program, just head a file with list of hosts in a cluster and ssh to it.
- $myCLUSTERDIR=~/pg/myclusters
- function goto() {
- 150 #######
- 151 ###### basic structure: set the DIR
- 152 echo 'Ssh to the first host in a cluster'
- 153 local gotoHost
- 154 if [ -z $1 ]; then
- 155 echo 'Must specify a cluster name'
- 156 echo 'Usage: gotoHost cluster_name'
- 157 return
- 158 fi
- 159
- 160 ## get the code
- 161 gotoHost="$(head -n 1 $myCLUSTERDIR/$1)"
- 162
- 163 ssh $gotoHost
- 164 }
- but when i run 'goto generic_prod', it generate errors (i set -x)
- $ goto generic_prod
- + goto generic_prod
- + echo 'Ssh to the first host in a cluster'
- Ssh to the first host in a cluster
- + local gotoHost
- + '[' -z generic_prod ']'
- ++ head -n 1 /Users/xyz/pg/myclusters/generic_prod
- + gotoHost=$'10-64-149-130-uswest1bprod.xyz.com\r'
- + ssh $'10-64-149-130-uswest1bprod.xyz.com\r'
- : nodename nor servname provided, or not knownuswest1bprod.xyz.com
- the ssh line is weird to me.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement