Skip to content

Commit

Permalink
make the code a bit more readable
Browse files Browse the repository at this point in the history
Signed-off-by: Mattias Andrée <[email protected]>
  • Loading branch information
maandree committed May 7, 2015
1 parent 1d00065 commit 56868d1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions sshcd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
t="${!#}"
c=("ssh" "-t" "${@:1:$(($#-1))}" "${t%:*}" "cd ${t##*:}; exec \$SHELL -l")
exec "${c[@]}"

#!/bin/bash
options=("${@:1:$(($# - 1))}") # Everything in "$@" except the last argument
target="${!#}" # The last argument from "$@"
remote="${target%:*}"
path="${target##*:}"
exec ssh -t "${options[@]}" "${remote}" "cd ${path}; exec \$SHELL -l"

0 comments on commit 56868d1

Please sign in to comment.