@@ -22,7 +22,7 @@ pkg="$1"
2222shift
2323
2424# A second argument will provide a hint to run
25−if ! [ -z "$1" ]; then
25+if [ -n "$1" ]; then
2626 name="$1"
2727 shift
2828else
@@ -53,11 +53,11 @@ run_linux_desktop_app () {
5353 file="$1"
5454 shift
5555
56− cmd=$(grep '^Exec' $file | tail -1 | \
56+ cmd=$(grep '^Exec' "$file" | tail -1 | \
5757 sed 's/Exec=//;s/^"//;s/" *$//')
5858
59− if ! [ -z "$@" ]; then
60− cmd=$(echo "$cmd" | sed "s/%[fu]/$1/;s/%[FU]/$@/")
59+ if [ "$#" -gt 0 ]; then
60+ cmd=$(echo "$cmd" | sed "s/%[fu]/$1/;s/%[FU]/$*/")
6161 fi
6262
6363 cmd=$(echo "$cmd" | sed "s/%k/$desktop/;s/%.//")
@@ -79,20 +79,20 @@ elif [ -x "$out/bin/run" ]; then
7979 run_bin "$out/bin/run" "$@"
8080elif [ "$(uname)" = Darwin ] && [ -d "$out/Applications/$name.app" ]; then
8181 run_darwin_app "$out/Applications/$name.app" "$@"
82−elif [ "$(uname)" = Darwin ] && [ -d $out/Applications/*.app ]; then
83− for f in $out/Applications/*.app; do
82+elif [ "$(uname)" = Darwin ] && [ -d "$out"/Applications/*.app ]; then
83+ for f in "$out"/Applications/*.app; do
8484 run_darwin_app "$f" "$@"
8585 done
8686elif [ -f "$out/share/applications/$name.desktop" ]; then
87− run_linux_desktop_app "$out/share/applications/$name.desktop" $@
88−elif [ -d $out/share/applications ]; then
89− for f in $out/share/applications/*.desktop; do
87+ run_linux_desktop_app "$out/share/applications/$name.desktop" "$@"
88+elif [ -d "$out"/share/applications ]; then
89+ for f in "$out"/share/applications/*.desktop; do
9090 run_linux_desktop_app "$f"
9191 done
9292elif [ -x "$out/bin/$name" ]; then
9393 run_bin "$out/bin/$name" "$@"
9494elif [ -d "$out/bin" ]; then
95− for bin in $out/bin/*; do
95+ for bin in "$out"/bin/*; do
9696 run_bin "$bin" "$@"
9797 done
9898else