mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Added a bit about full paths and 'find'
15
SC2012.md
15
SC2012.md
@@ -69,6 +69,21 @@ $ find .snapshot -maxdepth 1 ! -name .snapshot
|
|||||||
.snapshot/rnapdev1-svm_4_05am_6every4hours.2019-04-02_1205
|
.snapshot/rnapdev1-svm_4_05am_6every4hours.2019-04-02_1205
|
||||||
.snapshot/snapmirror.1501b4aa-3f82-11e8-9c31-00a098cef13d_2147868328.2019-04-01_190000
|
.snapshot/snapmirror.1501b4aa-3f82-11e8-9c31-00a098cef13d_2147868328.2019-04-01_190000
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** If the directory argument to find is a fully expressed path (`/home/somedir/.snapshot`), then you should use `basename` on the `-name` filter:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ theDir="$HOME/.snapshot"
|
||||||
|
$ find "$theDir" -maxdepth 1 ! -name "$(basename $theDir)"
|
||||||
|
/home/matt/.snapshot/rnapdev1-svm_4_05am_6every4hours.2019-04-02_0005
|
||||||
|
/home/matt/.snapshot/rnapdev1-svm_4_05am_6every4hours.2019-04-02_0405
|
||||||
|
/home/matt/.snapshot/rnapdev1-svm_4_05am_6every4hours.2019-04-02_0805
|
||||||
|
/home/matt/.snapshot/rnapdev1-svm_4_05am_6every4hours.2019-04-01_1605
|
||||||
|
/home/matt/.snapshot/rnapdev1-svm_4_05am_6every4hours.2019-04-01_2005
|
||||||
|
/home/matt/.snapshot/rnapdev1-svm_4_05am_6every4hours.2019-04-02_1205
|
||||||
|
/home/matt/.snapshot/snapmirror.1501b4aa-3f82-11e8-9c31-00a098cef13d_2147868328.2019-04-01_190000
|
||||||
|
```
|
||||||
|
|
||||||
#### All the other info
|
#### All the other info
|
||||||
|
|
||||||
If trying to parse out any other fields, first see whether `stat` (GNU, OS X, FreeBSD) or `find -printf` (GNU) can give you the data you want directly.
|
If trying to parse out any other fields, first see whether `stat` (GNU, OS X, FreeBSD) or `find -printf` (GNU) can give you the data you want directly.
|
||||||
|
Reference in New Issue
Block a user