Merge branch 'master' of github.com:dylanaraps/pure-bash
This commit is contained in:
19
README.md
19
README.md
@@ -748,6 +748,11 @@ for dir in ~/Downloads/*/; do
|
|||||||
printf '%s\n' "$dir"
|
printf '%s\n' "$dir"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Leverage brace expansion to loop, explicit reference
|
||||||
|
for file in /path/to/parentdir/{file1,file2,subdir/file3}; do
|
||||||
|
printf '%s\n' "$file"
|
||||||
|
done
|
||||||
|
|
||||||
# Iterate recursively.
|
# Iterate recursively.
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
for file in ~/Pictures/**/*; do
|
for file in ~/Pictures/**/*; do
|
||||||
@@ -1376,17 +1381,21 @@ successful command. `:` always succeeds so we can abuse it to store the
|
|||||||
variable value.
|
variable value.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Example snippet from Neofetch.
|
# Modified snippet from Neofetch.
|
||||||
case "$(uname)" in
|
case "$OSTYPE" in
|
||||||
"Linux" | "GNU"*)
|
"darwin"*)
|
||||||
|
: "MacOS"
|
||||||
|
;;
|
||||||
|
|
||||||
|
"linux"*)
|
||||||
: "Linux"
|
: "Linux"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*"BSD" | "DragonFly" | "Bitrig")
|
*"bsd"* | "dragonfly" | "bitrig")
|
||||||
: "BSD"
|
: "BSD"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"CYGWIN"* | "MSYS"* | "MINGW"*)
|
"cygwin" | "msys" | "win32")
|
||||||
: "Windows"
|
: "Windows"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user