由买买提看人间百态

topics

全部话题 - 话题: c002
(共0页)
r********s
发帖数: 179
1
[6:19pm] echo $SHELL
/bin/tcsh
[6:20pm] alias prsth 'echo "It Works"'
[6:20pm] cat > xixi.csh
#!/bin/csh
prsth
[6:21pm] chmod +x xixi.csh
[6:21pm] ./xixi.csh
prsth: Command not found.
[6:21pm] cat > xixi.csh
#!/bin/csh
alias prsth 'echo "It Works"'
prsth
[6:28pm] ./xixi.csh
It Works
**********
From the above test, we can see this might be the case touchsoul got stuck in.
i.e., even when you are using csh/tcsh, yo
r********s
发帖数: 179
2
来自主题: Unix版 - sed question??
下面这个用cut命令:
[8:35pm] cat t
12 34 56
[8:36pm] cut -d " " -f1 t ; cut -d " " -f2 t ; cut -d " " -f3 t
12
34
56
[8:36pm]
可以写一个script来偷懒:
# shell script to replace space with new line
#!/bin/sh
echo -n "Enter the input file name: "
read input
cut -d " " -f1 $input; cut -d " " -f2 $input; cut -d " " -f3 $input
以下为运行结果:
[8:44pm] sh xixi
Enter the input file name: t
12
34
56
[8:46pm]
r********s
发帖数: 179
3
Let's do a test in explicit shell definition.
[12:04am] tail -n 1 ~/.cshrc
alias prsth 'echo "It Works"'
[12:04am] cat xixi.csh
#!/bin/csh
prsth
[12:04am] ./xixi.csh
It Works
[12:04am] cat xixi.sh
#!/bin/sh
prsth
[12:04am] ./xixi.sh
./xixi.sh: prsth: not found
Isn't it clear now?
r********s
发帖数: 179
4
来自主题: Unix版 - sed question??
[7:06pm] cat t
12 34 56
[7:06pm] cat xixi.awk
BEGIN {FS=" "}
{
x1=$1
x2=$2
x3=$3
printf("%s\n", x1)
printf("%s\n", x2)
printf("%s\n", x3)
}
[7:06pm] awk -f xixi.awk t
12
34
56
[7:06pm]
r********s
发帖数: 179
5
[10:45pm] cat hoho.sh
#!/bin/sh
cd bbs
ls
echo -n "Which directory you wanna browse:\t "
read answer
if [ -d $answer ]
then
cd $answer
echo "The content of lastpost is:\n"
echo "******"
cat "/home/rhino/bbs/$answer/lastpost"
echo "******"
else
echo "$answer directory does not exitst!"
fi
[10:45pm] ls -R bbs
family love sysop
bbs/family:
lastpost
bbs/love:
lastpost
bbs/sysop:
lastpost
[10:46pm] ./hoho.sh
family love s
g***y
发帖数: 3
6
现在总是扶着床围栏站,想买个安全一点的餐椅。aingC002可以躺着,8个月了这个功
能是不是用不到了?还有别的型号推荐码?多谢各位美妈了
d***e
发帖数: 6
7
我家是用的这个费雪便携,绑上后娃坐在椅子上,脚能放到下面的大人椅子面上,然后
就蹬蹬蹬使劲踩着拱。。。
http://www.amazon.com/Fisher-Price-Healthy-Care-Booster-Green/d
周末出去吃饭,用了餐厅的宜家餐椅,感觉还不错诶,脚悬在下面没地方使力了,哈哈
(共0页)