8
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ftp接続を自動化

Last updated at Posted at 2016-06-16

参考

スクリプト用意

ftp_put.sh
# !/bin/sh

SERVER=$1
USER=$2
PASS=$3
FILE=$4

if [ $# -eq 3 ];then
# lsするだけ
    ftp -n <<END
    open $SERVER
    user $USER $PASS
    binary
    prompt
    passive
    ls
END
    exit 0
fi

# 転送
ftp -n <<END
    open $SERVER
    user $USER $PASS
    binary
    prompt
    passive
    ls
    mput $FILE
    ls
END

使い方例

lsするだけ
./ftp_put.sh localhost user1 Cih0lohM
転送例
./ftp_put.sh localhost user1 Cih0lohM .bashrc
8
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?