In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail for you how to achieve in the specified directory to find the specified suffix file shell script code, the editor feels very practical, so share to you to do a reference, I hope you can get something after reading this article.
The code is as follows:
#! bin/sh
# find files with the specified suffix in the specified location, including subdirectories
# usage:
# findf $1 $2
# the first parameter is a suffix
# find the file with the specified suffix and print it
# link:www.yisu.com
# date:2013/2/26
F ()
{
List= `find $2 | grep "/ .$ 1 / >" `
For i in $list
Do
Echo $I
Done
}
# Printing usage
Print ()
{
Echo "usage:"
Echo "$1 / $1 / $2"
Echo "the first parameter is the specified suffix name, such as'h'"
Echo "the second parameter is the specified directory, if this parameter is omitted, it defaults to the current directory"
Exit-1
}
# find in the current directory
F1 ()
{
F "$1" * "
}
# find in the specified directory
F2 ()
{
Cd $2
F "$1" * "
}
If ["$#"-lt "1"]
Then
Echo "too few parameters are given, at least one parameter is required."
Print "$0"
Fi
If ["$#"-gt "2"]
Then
Echo "too many parameters are given, a maximum of two parameters are required."
Print "$0"
Fi
If ["$#"-eq "1"]
Then
F1 $1
Exit 0
Fi
If ["$#"-eq 2]
Then
F2 $1 $2
Exit 0
Fi
On "how to achieve in the specified directory to find the specified suffix file shell script code" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.