mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-21 05:44:07 -07:00
Additional argument check for remote hosts
This commit is contained in:
parent
defba72215
commit
32fbc253a9
1 changed files with 5 additions and 3 deletions
|
@ -38,8 +38,8 @@ EOF
|
||||||
sftpc() {
|
sftpc() {
|
||||||
expect -f "-" <<EOF "$@"
|
expect -f "-" <<EOF "$@"
|
||||||
set count 0
|
set count 0
|
||||||
spawn /usr/bin/sftp -o StrictHostKeyChecking=no -o \
|
spawn "/usr/bin/sftp -o StrictHostKeyChecking=no -o \
|
||||||
Port=$port $user@$host
|
Port=$port '$user@$host'"
|
||||||
expect {
|
expect {
|
||||||
"password:" {
|
"password:" {
|
||||||
send "$password\r"
|
send "$password\r"
|
||||||
|
@ -94,12 +94,14 @@ EOF
|
||||||
|
|
||||||
if [ "$type" != 'local' ];then
|
if [ "$type" != 'local' ];then
|
||||||
check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]"
|
check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]"
|
||||||
is_format_valid 'host'
|
is_format_valid 'user' 'host'
|
||||||
is_password_valid
|
is_password_valid
|
||||||
if [ "$type" = 'sftp' ]; then
|
if [ "$type" = 'sftp' ]; then
|
||||||
which expect >/dev/null 2>&1
|
which expect >/dev/null 2>&1
|
||||||
check_result $? "expect command not found" $E_NOTEXIST
|
check_result $? "expect command not found" $E_NOTEXIST
|
||||||
fi
|
fi
|
||||||
|
host "$host" >/dev/null 2>&1
|
||||||
|
check_result $? "host connection failed" "$E_CONNECT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue