gpt4 book ai didi

linux - 编译这个 bash 命令

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:07:30 26 4
gpt4 key购买 nike

对于我的 openVPN 配置,我试图点击这段代码,但它不起作用。不是 Bash 命令的忠实粉丝,所以我需要帮助编译它。有任何想法吗? (目前使用 Kali linux,每次我点击这段代码时,它都会显示错误消息 bash: syntax error near unexpected token &&)

echo "Enter clientName:" && set CLIENTNAME = $< && printf "\n<ca>\n" >> ./client.conf && cat ./ca.crt >> ./client.conf && printf "</ca>\n" >> ./client.conf && printf "\n<cert>" >> ./client.conf && grep -v '^ ' ./$CLIENTNAME.crt | grep -v 'Certificate' >> ./client.conf && printf "</cert>\n" >> ./client.conf && printf "\n<key>\n" >> ./client.conf && cat ./$CLIENTNAME.key >> ./client.conf && printf "</key>\n" >> ./client.conf

最佳答案

问题是这不是 Bash 代码;它是 Tcsh代码:

$ echo $0
-bash
$ echo "Enter clientName:" && set CLIENTNAME = $< && printf "\n<ca>\n" >> ./client.conf && cat ./ca.crt >> ./client.conf && printf "</ca>\n" >> ./client.conf && printf "\n<cert>" >> ./client.conf && grep -v '^ ' ./$CLIENTNAME.crt | grep -v 'Certificate' >> ./client.conf && printf "</cert>\n" >> ./client.conf && printf "\n<key>\n" >> ./client.conf && cat ./$CLIENTNAME.key >> ./client.conf && printf "</key>\n" >> ./client.conf
-bash: syntax error near unexpected token `&&'

改变外壳:

$ tcsh
% echo $0
tcsh
% echo "Enter clientName:" && set CLIENTNAME = $< && printf "\n<ca>\n" >> ./client.conf && cat ./ca.crt >> ./client.conf && printf "</ca>\n" >> ./client.conf && printf "\n<cert>" >> ./client.conf && grep -v '^ ' ./$CLIENTNAME.crt | grep -v 'Certificate' >> ./client.conf && printf "</cert>\n" >> ./client.conf && printf "\n<key>\n" >> ./client.conf && cat ./$CLIENTNAME.key >> ./client.conf && printf "</key>\n" >> ./client.conf
Enter clientName:
foo

关于linux - 编译这个 bash 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43692471/

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