Bash script that creates desktop entry for an .AppImage
Create desktop entry:
./appimage-desktop-entry.sh /path/to/Example.AppImage
Remove desktop entry:
./appimage-desktop-entry.sh /path/to/Example.AppImage --remove
I decided to use the tool shellcheck as a linter for this script. It did find a few potential issues. This issues are not show-stoppers. I'm providing this bug report in the spirit of trying to be helpful, to spread the word of a useful tool called shellcheck. If you don't feel the need for a linter, please feel free to close this issue.
Thank you for making this useful script!
$ shellcheck appimage-desktop-entry.sh
In appimage-desktop-entry.sh line 11:
echo "File not found:" $APPIMAGE_PATH
^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
echo "File not found:" "$APPIMAGE_PATH"
In appimage-desktop-entry.sh line 21:
cd /tmp/
^------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
Did you mean:
cd /tmp/ || exit
In appimage-desktop-entry.sh line 23:
cd /tmp/squashfs-root/
^--------------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
Did you mean:
cd /tmp/squashfs-root/ || exit
In appimage-desktop-entry.sh line 26:
FILENAMES=($(ls -d *.png))
^------------^ SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).
^-- SC2035 (info): Use ./*glob* or -- *glob* so names with dashes won't become options.
In appimage-desktop-entry.sh line 28:
for filename in ${FILENAMES[*]}
^-------------^ SC2048 (warning): Use "${array[@]}" (with quotes) to prevent whitespace problems.
In appimage-desktop-entry.sh line 30:
printf " %d) %s\n" $i $filename
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
printf " %d) %s\n" "$i" "$filename"
In appimage-desktop-entry.sh line 31:
i=$(expr $i + 1)
^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
i=$(expr "$i" + 1)
In appimage-desktop-entry.sh line 34:
read SELECTED_INDEX
^--^ SC2162 (info): read without -r will mangle backslashes.
In appimage-desktop-entry.sh line 36:
ICON_SRC=${FILENAMES[$(expr $SELECTED_INDEX - 1)]}
^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
ICON_SRC=${FILENAMES[$(expr "$SELECTED_INDEX" - 1)]}
In appimage-desktop-entry.sh line 57:
rm $ICON_DST
^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
rm "$ICON_DST"
In appimage-desktop-entry.sh line 58:
rm $DESKTOP_ENTRY_PATH
^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
rm "$DESKTOP_ENTRY_PATH"
For more information:
https://www.shellcheck.net/wiki/SC2048 -- Use "${array[@]}" (with quotes) t...
https://www.shellcheck.net/wiki/SC2164 -- Use 'cd ... || exit' or 'cd ... |...
https://www.shellcheck.net/wiki/SC2207 -- Prefer mapfile or read -a to spli...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.