如何在Centos上运行Perl

2 篇文章 0 订阅
1 篇文章 0 订阅

一、检查是否已经安装perl,如果没有安装,进行安装

     [qinshiqi@localhost Desktop]$ rpm -q perl
     perl-5.10.1-127.el6.x86_64
     如果没有安装 ,通过yum -install perl进行安装。

     如何安装可参考:

    http://qinshiqi.iteye.com/admin/blogs/2036014

    [qinshiqi@localhost Desktop]$ perl -v二、创建一个*.pl文件      在CVS中,如果创建CVS用户 ,可以通过

引用      http://qinshiqi.iteye.com/admin/blogs/2035529
3、创建登录cvs服务的用户以及密码

[root@localhost CVSROOT]# htpasswd -c passwd yfeifei
New password:
Re-type new password:
Adding password for user yfeifei
d*_****
在/home/cvsroot/CVSROOT下运行htpasswd -c passwd yfeifei
(-c 会生成passwd文件,以后再创建用户就不需要 -c 参数了,可以使用 -n 参数直接指定用户名,但要在passwd文件中添加对应的用户名称加密密码以及:cvsroot)



(创建的feifei用户是以其所在群组为cvs的资格来可读可写可执行仓库中的文件)

修改passwd文件,在用户名后边加上cvsroot

*************************

[root@localhost CVSROOT]# htpasswd passwd qin
New password:
Re-type new password:
Adding password for user qin
[root@localhost CVSROOT]# cat passwd
yfeifei:7vV7AcR3pOORk:cvsroot
qishi:v8yvvdpJ71L7w:cvsroot
qin:9tTPnujUuKP82
[root@localhost CVSROOT]#

 

  也可以通过以下perl语言脚本生成用户的密码,直接通过编辑生成passwd的用户列表;

 

1:创建可以登陆cvs服务的用户及密码,需要创建文件passwd

vi /home/cvsroot/CVSROOT/passwd

 

文件内容如下:

qin:xxxxx:cvsroot

cvsroot是系统用户,就是把cvs用户qin与系统用户cvsroot等效

 

2.xxxxxx为密码,由以下文件生成: vi /home/cvsroot/pwdgen.pl 文件内容:

#!/usr/bin/perl
srand (time());
my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
my $plaintext = shift; my $crypttext = crypt ($plaintext, $salt);
print "${crypttext}\n";

3、生成pwdgen.pl脚本后可以像windows下一样运行 后边“test”是参数

    $perl pwdgen.pl "test"
    adMpHktIn0tR2
4、pwdgen.pl 脚本第一句

     #!/usr/bin/perl

    我们也可以直接给pwdgen.pl赋于可执行权限

   

chmod +x pwdgen.pl
./pwdgen.pl "some"

 

 5.Hello World

vi hello.pl

print "this is my first perl script\n";
print "Hello,world";


*********************************************************************

perl脚本的知识请参考

http://www.cnblogs.com/huochangjun/archive/2012/08/31/Perl.html

http://www.codesky.net/article/201007/131554.html

http://blog.sina.com.cn/s/blog_52510b1d01013a11.html

http://tech.it168.com/zt/perl/

http://jingyan.baidu.com/article/48b37f8d6c41eb1a646488bc.html

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值