Use shellcheck
This also adds set -e and friends where applicable.
This commit is contained in:
parent
56b9c6c37f
commit
b0d6861825
|
@ -63,6 +63,7 @@
|
||||||
src = ./.;
|
src = ./.;
|
||||||
hooks = {
|
hooks = {
|
||||||
nixpkgs-fmt.enable = true;
|
nixpkgs-fmt.enable = true;
|
||||||
|
shellcheck.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -138,6 +139,7 @@
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
buildInputs = (with pkgs; [
|
buildInputs = (with pkgs; [
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
|
shellcheck
|
||||||
sops
|
sops
|
||||||
ssh-to-pgp
|
ssh-to-pgp
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
card=$(pactl list cards short | grep -E -o "bluez_card.*" | cut -f1)
|
card=$(pactl list cards short | grep -E -o "bluez_card.*" | cut -f1)
|
||||||
# pactl does not support any easily parsable output format
|
# pactl does not support any easily parsable output format
|
||||||
profile=$(pactl list cards | rg -oU "Name: ${card}.*(\\n.*?)*.*Active Profile: (.*)" -r '$2')
|
profile=$(pactl list cards | rg -oU "Name: ${card}.*(\\n.*?)*.*Active Profile: (.*)" -r "\$2")
|
||||||
pacmd set-card-profile $card off
|
pacmd set-card-profile "$card" off
|
||||||
pacmd set-card-profile $card "$profile"
|
pacmd set-card-profile "$card" "$profile"
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
mkvextract "$1" attachments $(mkvmerge --identify "$1" | grep "Attachment ID" | sed "s/Attachment ID \([0-9]*\): .*/\1/")
|
set -eo pipefail
|
||||||
|
mkvextract "$1" attachments "$(mkvmerge --identify "$1" | grep "Attachment ID" | sed "s/Attachment ID \([0-9]*\): .*/\1/")"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
file="$1"
|
file="$1"
|
||||||
shift
|
shift
|
||||||
for attachment in "$@"; do
|
for attachment in "$@"; do
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
if (( $# < 2 )); then
|
if (( $# < 2 )); then
|
||||||
echo "USAGE: $0 DIGITS FILES"
|
echo "USAGE: $0 DIGITS FILES"
|
||||||
return 1
|
return 1
|
||||||
|
@ -6,7 +7,8 @@ fi
|
||||||
digits="$1"
|
digits="$1"
|
||||||
shift 1
|
shift 1
|
||||||
i=1
|
i=1
|
||||||
for file in $@; do
|
for file in "$@"; do
|
||||||
mv -n "$file" "$(dirname $file)/$(printf %0${digits}d $i).${file##*.}"
|
file="$(readlink -f "$file")"
|
||||||
|
mv -n "$file" "${file%/*}/$(printf "%0${digits}d" "$i").${file##*.}"
|
||||||
i="$((i+1))"
|
i="$((i+1))"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue