bash smbclient:找不到命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33919527/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 13:56:31  来源:igfitidea点击:

smbclient: command not found

linuxbash

提问by Zydargon

I would like to connect to a remote server with the smbclientcommand and pass some arguments to the script.

我想使用smbclient命令连接到远程服务器并将一些参数传递给脚本。

Here is my command:

这是我的命令:

smbclient //$SERVER -c 'cd $PATH;get $FILE /tmp/$FILE' $PASS -U$PSEUDO -W domain

When I launch this command without variables on the command line it works. But when I use it in the script it says:

当我在命令行上没有变量的情况下启动此命令时,它可以工作。但是当我在脚本中使用它时,它说:

./test1.sh: line 14: smbclient: command not found

Why is that?

这是为什么?

Here is my complete script with for exemple arguments testSRV, testPATH and testFile :


\#! /bin/bash

SERVEUR=
PATH=
FILE=

echo $PATH #Return testPATH
echo $FILE #Return testFILE

\#COMPLETEPATH="cd $testPATH;get $testFILE /tmp/$testFILE"

\#echo $COMPLETEPATH //return

/usr/bin/smbclient //$SERVER -c 'cd $PATH;get $FILE' testpassword -U testuser -W testdomain

回答by Tammert

You have two options: ensure /usr/bin is on your PATH (echo $PATH to see if this is the case) or edit the script to call smbclient with the full path (/usr/bin/smbclient)

您有两个选择:确保 /usr/bin 在您的 PATH 上(回显 $PATH 以查看是否是这种情况)或编辑脚本以使用完整路径 (/usr/bin/smbclient) 调用 smbclient

回答by Zydargon

It's good,

很好,

Thanks you all but I achieved to make my script works.

谢谢大家,但我已经让我的脚本工作了。

I tried to replace single quote with double quote and put the full command path

我试图用双引号替换单引号并放置完整的命令路径