mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-09-11 06:55:53 +03:00
nix-run.sh: fix shellcheck warnings
This commit is contained in:
parent
5672912336
commit
b90d88d50f
20
nix-run.sh
20
nix-run.sh
@ -22,7 +22,7 @@ pkg="$1"
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
# A second argument will provide a hint to run
|
# A second argument will provide a hint to run
|
||||||
if ! [ -z "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
name="$1"
|
name="$1"
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
@ -53,11 +53,11 @@ run_linux_desktop_app () {
|
|||||||
file="$1"
|
file="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
cmd=$(grep '^Exec' $file | tail -1 | \
|
cmd=$(grep '^Exec' "$file" | tail -1 | \
|
||||||
sed 's/Exec=//;s/^"//;s/" *$//')
|
sed 's/Exec=//;s/^"//;s/" *$//')
|
||||||
|
|
||||||
if ! [ -z "$@" ]; then
|
if [ "$#" -gt 0 ]; then
|
||||||
cmd=$(echo "$cmd" | sed "s/%[fu]/$1/;s/%[FU]/$@/")
|
cmd=$(echo "$cmd" | sed "s/%[fu]/$1/;s/%[FU]/$*/")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmd=$(echo "$cmd" | sed "s/%k/$desktop/;s/%.//")
|
cmd=$(echo "$cmd" | sed "s/%k/$desktop/;s/%.//")
|
||||||
@ -79,20 +79,20 @@ elif [ -x "$out/bin/run" ]; then
|
|||||||
run_bin "$out/bin/run" "$@"
|
run_bin "$out/bin/run" "$@"
|
||||||
elif [ "$(uname)" = Darwin ] && [ -d "$out/Applications/$name.app" ]; then
|
elif [ "$(uname)" = Darwin ] && [ -d "$out/Applications/$name.app" ]; then
|
||||||
run_darwin_app "$out/Applications/$name.app" "$@"
|
run_darwin_app "$out/Applications/$name.app" "$@"
|
||||||
elif [ "$(uname)" = Darwin ] && [ -d $out/Applications/*.app ]; then
|
elif [ "$(uname)" = Darwin ] && [ -d "$out"/Applications/*.app ]; then
|
||||||
for f in $out/Applications/*.app; do
|
for f in "$out"/Applications/*.app; do
|
||||||
run_darwin_app "$f" "$@"
|
run_darwin_app "$f" "$@"
|
||||||
done
|
done
|
||||||
elif [ -f "$out/share/applications/$name.desktop" ]; then
|
elif [ -f "$out/share/applications/$name.desktop" ]; then
|
||||||
run_linux_desktop_app "$out/share/applications/$name.desktop" $@
|
run_linux_desktop_app "$out/share/applications/$name.desktop" "$@"
|
||||||
elif [ -d $out/share/applications ]; then
|
elif [ -d "$out"/share/applications ]; then
|
||||||
for f in $out/share/applications/*.desktop; do
|
for f in "$out"/share/applications/*.desktop; do
|
||||||
run_linux_desktop_app "$f"
|
run_linux_desktop_app "$f"
|
||||||
done
|
done
|
||||||
elif [ -x "$out/bin/$name" ]; then
|
elif [ -x "$out/bin/$name" ]; then
|
||||||
run_bin "$out/bin/$name" "$@"
|
run_bin "$out/bin/$name" "$@"
|
||||||
elif [ -d "$out/bin" ]; then
|
elif [ -d "$out/bin" ]; then
|
||||||
for bin in $out/bin/*; do
|
for bin in "$out"/bin/*; do
|
||||||
run_bin "$bin" "$@"
|
run_bin "$bin" "$@"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user