File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,27 @@ Demonstrates techniques for globbing and operating on sets of files
4
4
5
5
TODO:
6
6
7
- 1 . Use globbing from shell
8
- 1 . Using globbing in scripts
9
7
1 . shopts and controlling behaviour
10
- 1 . path expansion
8
+ 2 . path expansion
9
+
10
+ ## Looping
11
+
12
+ ``` sh
13
+ # enter shell
14
+ bash
15
+
16
+ # enable globbing
17
+ set +f
18
+
19
+ # loop
20
+ counter=1
21
+ for file in * ; do
22
+ echo " $file -> ${counter} "
23
+ counter=$(( counter + 1 ))
24
+ done
25
+ ```
26
+
27
+ ## Oneliners
11
28
12
29
``` bash
13
30
# For each directory name create an empty file in the out directory with the filename the same as the directory
@@ -25,9 +42,13 @@ find .. -name "[0-9][0-9]_*" -exec echo {} \;
25
42
grep -R " /usr/bin/env" --include=" *.sh" ../*
26
43
```
27
44
45
+ ## Zsh
46
+
28
47
``` zsh
29
48
# zsh
30
49
setopt extendedglob
31
50
ls ^d* .txt
32
51
unsetopt extendedglob
33
52
```
53
+
54
+ ## Resources
You can’t perform that action at this time.
0 commit comments