Merge branch 'master' of github.com:dylanaraps/pure-bash

This commit is contained in:
Dylan Araps
2018-06-18 11:06:05 +10:00

View File

@@ -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"
;; ;;