-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathssh-host
More file actions
executable file
·33 lines (32 loc) · 807 Bytes
/
Copy pathssh-host
File metadata and controls
executable file
·33 lines (32 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
## Wrapps the SSH command adding support for alias host names.
##
## Example:
## ssh-host host_alias [ssh arguments]
##
## host_alias is a short made-up alias. The first time, this command
## interactivly prompts for the host and user values and saves them for the
## next runs. Pay attention to the file name, you can edit that file.
##
## Examples:
##
## * SSH to to a remote host:
## ssh-host db
##
## * List a remote directory:
## ssh-host db ls
##
## * List a remote directory:
## echo ls | ssh-host db
##
## * Testing return value:
## echo ls . | ssh-host db && pwd
##
## * Testing return value:
## echo ls nowhere | ssh-host db && pwd
##
alias=$1
. $(dirname $0)/prj-env $alias,user,host
user_host=$user${user:+@}$host
shift 1
ssh $user_host $*