做网店的网站,百度置顶广告多少钱,python创建wordpress,app开发首先#xff0c;不是在BASH脚本中使用$USERNAME。 $USERNAME是一个包含当前用户名的BASH变量。实际上#xff0c;在BASH中使用UPPERCASE变量通常是一个糟糕的主意。大多数BASH环境变量都是大写字母#xff0c;可能会导致混淆。让你的变量小写是个好习惯。此外#xff0c;因…首先不是在BASH脚本中使用$USERNAME。 $USERNAME是一个包含当前用户名的BASH变量。实际上在BASH中使用UPPERCASE变量通常是一个糟糕的主意。大多数BASH环境变量都是大写字母可能会导致混淆。让你的变量小写是个好习惯。此外因为我想你想要使用HTML表单来做到这一点所以你不能让BASH从STDIN中读取数据。修改游脚本以将用户名作为参数BASH#!/bin/bashuser$1;DISPLAYNAMEldapsearch -p xxx -LLL -x -w test -h abc.com -D abc -b dcabc,dccom sAMAccountName$user | grep displayNameif [ -z $DISPLAYNAME ]; thenecho No entry found for $userelseecho Entry found for $userfi的Perl#!/usr/bin/perluse CGI qw(:standard);use CGI::Carp qw(warningsToBrowser fatalsToBrowser);use strict;use warnings;## Create a new CGI objectmy $cgi new CGI;## Collect the value of user_name submitted by the webpagemy $name$cgi-param(user_name);## Run a system command, your display_name.sh,## and save the result in $resultmy $result./display_name.sh $name;## Print the HTML headerprint header;## Print the resultprint $result;HTML这应该做你所需要的。它假设这两个脚本都位于网页的./cgi-bin/目录中并被称为display_name.sh和display_name.pl。它还假定你已经正确设置了他们的权限(他们需要由apache2的用户www-data执行)。最后它假定您已经设置了apache2来允许执行./cgi-bin中的脚本。是否有您想使用BASH的特定原因您可以直接从Perl脚本执行所有操作#!/usr/bin/perluse CGI qw(:standard);use CGI::Carp qw(warningsToBrowser fatalsToBrowser);use strict;use warnings;## Create a new CGI objectmy $cgi new CGI;## Collect the value of name submitted by the webpagemy $name$cgi-param(user_name);## Run the ldapsearch system command## and save the result in $resultmy $resultldapsearch -p xxx -LLL -x -w test -h abc.com -D abc -b dcabc,dccom sAMAccountName$name | grep displayName;## Print the HTML headerprint header;## Print the result$result ?print Entry found for $name :print No entry found for $name;