gpt4 book ai didi

linux - ./MakeOVPN.sh : line 12: [! -fDanielIphone.crt]:找不到命令

转载 作者:太空宇宙 更新时间:2023-11-04 04:33:57 24 4
gpt4 key购买 nike

我正在尝试在我的树莓派上使用开放 VPN 来创建 VPN,并且我当前正在使用终端输入一个文件,为我想要连接的设备创建配置文件脚本。使用 BBC 的分步指南。我已经尝试解决这个问题大约一个小时了,但我不断收到相同的错误,请帮助。

#!/bin/bash
DEFAULT="Default.txt"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".3des.key"
CA="ca.crt"
TA="ta.key"

echo "Please enter an existing Client Name:"
read NAME

if [!-f$NAME$CRT]; then
echo "[ERROR]: Client Public Key Certificate not found: $NAME$CRT"
exit
fi
echo "Client's cert found:$NAME$CR"
if [!-f$NAME$KEY]; then
echo "[ERROR]: Client 3des Private Key not found:$NAME$KEY"
exit
fi
echo "Client's Private Key found:$NAME$KEY"

Error From Code

最佳答案

尝试在 if 语句中添加额外的空格:

if [ ! -f $NAME$CRT ]; then

完整的脚本现在是:

#!/bin/bash
DEFAULT="Default.txt"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".3des.key"
CA="ca.crt"
TA="ta.key"

echo "Please enter an existing Client Name:"
read NAME

if [ ! -f $NAME$CRT ]; then
echo "[ERROR]: Client Public Key Certificate not found: $NAME$CRT"
exit
fi
echo "Client's cert found:$NAME$CR"

这是一个演示,表明它是有效的:

$ chmod +x ./myscript 

$ touch foo.crt

$ ./myscript
Please enter an existing Client Name:
foo
Client's cert found:foo

$ ./myscript
Please enter an existing Client Name:
bar
[ERROR]: Client Public Key Certificate not found: bar.crt

关于linux - ./MakeOVPN.sh : line 12: [! -fDanielIphone.crt]:找不到命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35512779/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com