`
yeluowuhen
  • 浏览: 151511 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

每天一道编程题(11)

 
阅读更多

1.       Display a list of /usr/share/doc subdirectories containing information about shells.

 

find /usr/share/doc/ | xargs grep 'shells'  

 2.  How many README files do these subdirectories contain? Don't count anything in the form of README.a_string.

 

 

find /usr/share/doc/ -name 'README' | wc -l

3.  Can you find an alternative for wc -l, using grep?

 

 

 

grep -c '^' 

 4. Make a script that checks whether a user exists in /etc/passwd. For now, you can specify the user name in the script, you don't have to work with arguments and conditionals at this stage.

 

     

read -p "Please input the name" name
cat /etc/passwd  |grep $name

 5. Display configuration files in /etc that contain numbers in their names.

find /etc/ -name "[0-9]" 

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics