说在我得到的给定目录中
原文链接:https://www.f2er.com/bash/385521.htmltzury@x200:~/Desktop/sandBox$ls -l total 20 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P000 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P001 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P002 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P003 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P004 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N01.P000 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N01.P001 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N01.P002
我寻求一种bash方式来获取其名称比给定参数更大或更小的文件列表,例如:
$my_finder lt N00.P003
应返回N00.P000,N00.P001和N00.P002
$my_finder gt N00.P003
应返回N00.P004,N01.P000,N01.P001和N01.P002
我想在$(ls)和$name!= $2中迭代名称,但相信有更优雅的方式这样做