Single Line sftp from Terminal

前端 未结 6 1456
渐次进展
渐次进展 2020-12-22 20:59

Several times throughout the day, I may be running a test where I need to look through a log file on a remote server. I\'ve gotten used to using my terminal to sftp

6条回答
  •  忘掉有多难
    2020-12-22 21:40

    sftp supports batch files.

    From the man page:

    -b batchfile
    
    Batch mode reads a series of commands from an input batchfile instead of stdin.  
    Since it lacks user interaction it should be used in conjunction with non-interactive
    authentication.  A batchfile of `-' may be used to indicate standard input.  sftp 
    will abort if any of the following commands fail: get, put, rename, ln, rm, mkdir, 
    chdir, ls, lchdir, chmod, chown, chgrp, lpwd, df, symlink, and lmkdir.  Termination 
    on error can be suppressed on a command by command basis by prefixing the command 
    with a `-' character (for example, -rm /tmp/blah*).
    

提交回复
热议问题