In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly talks about "the application of dir command parameters in linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "the application of dir command parameters in linux"!
The following is how to use the dir command parameter in linux.
Dir command parameter function in linux:
The command formats supported by the dir command parameters in linux are:
DIR [filename] [/ O[sortorder]] [/ S] [/ W]
Dir command parameters in linux are not case-sensitive and support multiple parameters.
The following parameters are mainly supported:
/ ON sorts by name
/ OE sorts by extension
/ OS sorts by size
/ OD is sorted by modification time
/ S display subdirectory file
/ W is in wide list format
The idea of dir command parameters in 1.linux is: through the judgment of each parameter, the corresponding command string (var) in DOS is constructed and run.
two。 Since it is impossible to determine how many parameters the command has in advance, use the shift statement to move the parameter to the left, judge the case of the $1 parameter through the case statement, and add the corresponding command parameter under bash to the end of the command string to be run.
3. What needs extra processing is that the dir command parameter in linux corresponds to ls-a-l, while dir / w corresponds to ls-a-m. This is done by processing the existence of "/ w" or "/ W" in $* by recording the number of times "/ w" or "/ W" appear. If * is 0, the initial value of the command string to be run is ls-a-l, otherwise it is ls-a-m. The case of other parameters is then processed (through the case statement).
Dir command parameter code in linux:
If ["$1" = "/?"]
Then
Echo "show the files in the directory or subdirectory"
Echo "DIR [filename] [/ O [sortorder]] [/ S] [/ W]"
Echo "/ O sort by"
Echo "sortorder N by name S by size"
Echo "E by extension D by time"
Echo "/ S show the files in the directory and subdirectory"
Echo "/ W use wide list format"
Exit 1
Fi
ITunes 0
Var=ls
Varapp= ""
For id
Do
If ["$id" = "/ W"]
Then
I = `expr $I + 1`
Fi
If ["$id" = "/ w"]
Then
I = `expr $I + 1`
Fi
Done
If [$I-eq 0]
Then
Varapp= "- a-l"
Else
Varapp= "- a-m"
Fi
If [$#-gt 0]
Then
While [$#-gt 0]
Do
Case $1 in
/ OE | / oe | / Oe | / oE) var=$var$ "- X"
/ OD | / od | / Od | / oD) var=$var$ "- t"
/ OS | / os | / Os | / oS) var=$var$ "- s"
/ ON | / on | / On | / oN) var=$var
/ S | / s) var=$var$ "- R"
/ W | / w) var=$var
*) var=$var "$1"
Esac
Shift
Done
Fi
Var=$var$varapp
$var
At this point, I believe you have a deeper understanding of "the application of dir command parameters in linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.