Skip to content
Snippets Groups Projects

Get rsync'able path with one command

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Frank Sauerburger

    sshpath is a small bash script to get the full path (of the form user@host:/abs/path) of a file with a single command. The tool can be used to generate a path that can then be used in rsync.

    Edited
    sshpath 386 B
    #!/bin/bash                                                                                                                                                                                                                                                                [71/74]
    
    if [ "$#" != 1 ]; then
      echo "Usage: $0 FILE"
      exit 1
    fi
    
    echo $(whoami)@$(hostname -f):$(readlink -f "$1")
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment