2007 十月 31 星期三 16:27 – 16:27
#!/usr/bin/perl
open(TMPFILE,”filename.txt”)||die “error”;while($line=<TMPFILE>){ if ( $line =~ /zz_\d+\.tar\.bz2/ ) { $tmp= $&; } last}close(TMPFILE);system(”cd path1 ; bunzip2 < path2/$tmp | tar xvf - “);
阅读(109 次)
2007 十月 30 星期二 22:21 – 22:21
system(’cmd’)获取不到命令的输出只能返回命令成功与否
反引号`cmd`能返回命令的输出
阅读(283 次)
2007 十月 29 星期一 14:31 – 14:31
修改/etc/fstab#vi /etc/fstab ,在 LABEL=/export/home /export/home ext3 defaults 1 2此行激活磁盘配额,修改后的结果如下:LABEL=/export/home /export/home ext3 defaults,usrquota,grpquota 1 2
重新装载文件系统,使改变生效 重新激活/etc/fstab改变#mount -o remount /export/home
进行配额检查#quotacheck -cmug /export/home生成相应的配额文件aquota.user aquota.group
对用户test设置配额运行如下命令:edquota testDisk quotas for user test (uid 1054): Filesystem blocks soft hard inodes soft hard /dev/sda7 1240 0 0 300 0 0blocks是指现在该用户使用的block数目(一个block为1kB)后面跟着的soft和hardsoft(第一个)-软磁盘空间限制,表示用户可以使用的磁盘空间大小,单位为KB。可以有7天(默认)的超越,过后自动转为硬限制,不限制设置为0 hard(第一个)-硬配额限制,不能超越,表示用户可以使用的最大磁盘空间,单位为KB,不限制设置为0nodes-当前文件个数 后面跟着的soft和hardsoft(第二个)-软磁盘空间限制,可以有7天(默认)的超越,表示用户可以创建的文件个数,包括目录,可以有默认七天的超越hard(第二个)-硬配额限制,不能超越,表示用户可以创建的文件个数,不能超过。现在修改为Disk quotas for user test (uid 1054): […]
2007 十月 26 星期五 15:19 – 15:19
#!/usr/bin/perl
open(TMPFILE,”$ARGV[0]”)||die “error”;
open(SHOWFILE,”+>$ARGV[0].txt”)||die “error”;
while($line=<TMPFILE>)
{
$line =~ s/(\S)/$1/;
$line =~ s/\n/<\/code>$&/;
$line =~ s/^\s+//;
$tmp= $&;
$tmp=~ s/\n//g;
$tmp=~ s/[ \t]/ /g;
#print “$tmp\n”;
$line= $tmp.$line;
print $line;
}
close(TMPFILE);
close(SHOWFILE);
阅读(89 次)
2007 十月 26 星期五 11:08 – 11:08
#!/bin/bash
if [ -z “$1″ ]; then
echo “Usage : dusum [File or Directory] ”
exit 1;
fi
sum=0
for i in $*
do
k=0
for j in `du -sk $i`
do
if [ $k -eq 0 ]; then
echo “$j $i”
sum=$(($sum + $j))
k=1
else
k=0
fi
done
done
echo -e “\n”
echo “$sum”
注意作为命令参数的文件或目录名不能含空格等分隔符,否则会出错
阅读(190 次)
2007 十月 25 星期四 17:36 – 17:36
bunzip2 <filename.tar.bz2 | tar xvf -
可以一步解决
阅读(289 次)
2007 十月 24 星期三 18:02 – 18:02
例子
#!/bin/bash
sum=0
for i in $*
do
j=0
for((j=0;j<3;j++))
do
echo $j
done
echo $i
done
注意 要使用 初始值;条件;步进 格式 要使用(())而不是()
阅读(125 次)
2007 十月 24 星期三 9:59 – 9:59
/etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don’t
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
cmd1
cmd2
阅读(307 次)
2007 十月 23 星期二 16:46 – 16:46
安全标签里可以设置文件夹的权限
如果是XP Professional的话,需在“文件夹选项”中将“简单文件共享”取消,才会在文件夹的右键属性中看到安全选项卡。
阅读(154 次)