由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - 一个Shell问题
相关主题
如何删除一组文件或给一组文件更名?question
how to get part of a big text file?[转载] Shell高手看过来。
how to find "exact" word in a file.[转载] shell programming and awk questions
a question about "find"?shell问题请教
shell programming problemsmy script Re: how would you do this?
Shell Question再问一次。
Help on shell scriptlogin shell and normal shell?
为什么time命令无法重定向?how to change login shell?
相关话题的讨论汇总
话题: filename话题: grep话题: shell话题: tick话题: 赋值
进入Unix版参与讨论
1 (共1页)
a***u
发帖数: 14
1
我想把(cat filename | grep "^...")的东东赋值给i,再判断i是否有东西,该怎么做呀
p******f
发帖数: 162
2

i='grep "..." filename'
if test -n $i; then
...
fi
NOTE: the tick in the first line should be back-tick,
which i can't input, because it is defined as BOSS KEY by sterm.

【在 a***u 的大作中提到】
: 我想把(cat filename | grep "^...")的东东赋值给i,再判断i是否有东西,该怎么做呀
: ?

f***y
发帖数: 98
3
if i=`grep "^..." filename`; then ... should be fine.

【在 p******f 的大作中提到】
:
: i='grep "..." filename'
: if test -n $i; then
: ...
: fi
: NOTE: the tick in the first line should be back-tick,
: which i can't input, because it is defined as BOSS KEY by sterm.

1 (共1页)
进入Unix版参与讨论
相关主题
how to change login shell?shell programming problems
我是BBS的菜鸟,这样的帖子发在这个版,先祝大家不要晕倒。Shell Question
group permissionHelp on shell script
怎样用mail把某一文本文件发送给一个email地址?为什么time命令无法重定向?
如何删除一组文件或给一组文件更名?question
how to get part of a big text file?[转载] Shell高手看过来。
how to find "exact" word in a file.[转载] shell programming and awk questions
a question about "find"?shell问题请教
相关话题的讨论汇总
话题: filename话题: grep话题: shell话题: tick话题: 赋值