HELP ME !必给分!

hackerning 2002-03-07 12:51:52
writer a shell program named "test" to meet the following criteria:
1.you can choose your preferred shell(bash,sh,csh..)
2.synopsis:
test [option] directory-path
3.optin:
-h print out help message.
-e print the file count in the directory tree of directory-path
-t print the file count of different file type in the directory tree
of directory-path.the file type should include "text","ELE","script" and
"other"
-s print the all file names which file size is greater than 1M in the
directory tree of directory-path
-m Create or overwrite the file /tmp/haha that contains all file listing(
with absolute path) of *.mp3 and *.MP3 in the directory-path.
-o Sort all files in directory-path excluding dub-directory by date,
and print the sorted result on STD OUT.printed information should
only include file name,size and date.
...全文
41 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
hackerning 2002-03-18
  • 打赏
  • 举报
回复
可以!
minimini319 2002-03-16
  • 打赏
  • 举报
回复
这贴可以结了吗?
HOOLOO 2002-03-09
  • 打赏
  • 举报
回复
I don't know!
minimini319 2002-03-09
  • 打赏
  • 举报
回复
子目录:sub-directory??

-o ls -rtal $2 |awk '{print $3 $5 $7}'
hackerning 2002-03-09
  • 打赏
  • 举报
回复
dub-directory是子目录的意思
minimini319 2002-03-08
  • 打赏
  • 举报
回复
终于看懂了。。。

-m (ls -al $2|grep 'file type')>/tmp/haha

最后一道题dub-directory是什么意思地说?不明白~~~

minimini319 2002-03-08
  • 打赏
  • 举报
回复
-h 这个。。。你应该知道吧?

-e ls -a $2 |wc -w

-t ls -a $2 |grep 'file type'|wc -w

-s ls -al $2 |awk '$5 > 2048 {print $3}'

下面一题看不懂?/tmp/haha是文件?目录?


linuxnewer 2002-03-07
  • 打赏
  • 举报
回复
1.you can choose your preferred shell(bash,sh,csh..)
什么意思?
qisiwole 2002-03-07
  • 打赏
  • 举报
回复
PYTHON 很好用!
hackerning 2002-03-07
  • 打赏
  • 举报
回复
你这只是把程序的构架说了一遍,这个我也知道啊,就是想问你具体的那些功能用哪些命令或方法可以实现啊!谢谢 minimini319(minimini)!
wizardxd 2002-03-07
  • 打赏
  • 举报
回复
在shell中我不知道如何实现。
用c倒是写过类似的程序~
不知道是否有用~
minimini319 2002-03-07
  • 打赏
  • 举报
回复
vi test

然后在里面写

case $1

-h)........

-p)........



主要是注意参数1是$1,参数2是$2,然后再用case....esac在每个选项里写入具体的如create语句就可以了阿
hackerning 2002-03-07
  • 打赏
  • 举报
回复
wizardxd() ,我想问的是怎么写SHELL脚本来实现以上的功能啊!
duke136 2002-03-07
  • 打赏
  • 举报
回复
做个字符串分析,然后跳转到相应的shell命令调用shell。

呵呵,我也不懂,随便说说。
hackerning 2002-03-07
  • 打赏
  • 举报
回复
我问的是怎么实现以上的功能啊!不是翻译啊!谢谢
wizardxd 2002-03-07
  • 打赏
  • 举报
回复
-h print out help message.
打印帮助信息

-e print the file count in the directory tree of directory-path
打印指定目录路径的目录树下文件的个数
-t print the file count of different file type in the directory tree of directory-path.the file type should include "text","ELE","script" and "other"
打印指定目录路径的目录树下不相同文件的个数。文件类型必须包括
"text","ELE","script" 和 "other" 。

-s print the all file names which file size is greater than 1M in the directory tree of directory-path
打印指定目录路径的目录树下所有大于1m的文件的文件名。

-m Create or overwrite the file /tmp/haha that contains all file listing(with absolute path) of *.mp3 and *.MP3 in the directory-path.
创建或者覆盖/tmp/haha文件中指定的所有的文件(完全路径)。

-o Sort all files in directory-path excluding dub-directory by date,and print the sorted result on STD OUT.printed information should only include file name,size and date.
按日期排序所有在目录路径下除去重复的目录的文件,并且在标准输设备
上打印出排序后的列表。打印出来的信息仅仅包含了文件名,大小和日期。
linuxnewer 2002-03-07
  • 打赏
  • 举报
回复
瞪着眼睛看。
guduker 2002-03-07
  • 打赏
  • 举报
回复
test应该是SHELL脚本中的一个命令!用来检查表达式的真假!

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧