无法使用从shellscript运行的lftp命令 [英] Not able use lftp commands running from shellscript
问题描述
我正在使用Shellscript中的一组命令.第一个命令运行良好,但是它正在移至lftp命令提示符,并且期望手动输入,而不是从shelscript运行命令.以下是我正在使用的命令
I'm using set of commands from a shellscript. First command is running fine but it is moving to lftp command prompt and expecting manual input instead of running commands from shelscript. Following are the commands i'm using
lftp -e "$HOST"
lftp -u "$USER,$PWD"
lftp -e "cd /inbox"
put $file
bye
请给我一些解决方法
推荐答案
使用小写的变量名以避免与本地环境变量或shell-builtins冲突($USER
和$PWD
都是内置的,因此您不应该'可以自行设置):
Using lower-case variable names to avoid conflicts with local environment variables or shell-builtins ($USER
and $PWD
are both builtins, so you shouldn't be setting them yourself):
lftp \
-e "cd /inbox; put $file" \
-u "$user,$pwd" \
"$host"
这里的意思是只调用lftp
一次,并将所有必要的命令传递给该单个调用.
The point, here, is invoking lftp
only once, and passing all the necessary commands to that single invocation.
这篇关于无法使用从shellscript运行的lftp命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!