remove useless grep arg + adding comments + adding message at the end of the script

This commit is contained in:
Anri 2021-11-14 16:20:09 +01:00
parent 8e97555bbb
commit cef03fb9a3

View file

@ -1,14 +1,28 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# retrieve latest vscodium package
wget -q https://api.github.com/repos/VSCodium/vscodium/releases/latest wget -q https://api.github.com/repos/VSCodium/vscodium/releases/latest
grep -n 'browser_download_url": ".*.AppImage"' latest | awk '{ print substr ($0, 36 ) }' | awk '{ print substr( $0, 1, length($0)-1 ) }' > url grep 'browser_download_url": ".*.AppImage"' latest | awk '{ print substr ($0, 32 ) }' | awk '{ print substr( $0, 1, length($0)-1 ) }' > url
rm latest rm latest
# kill codium if already running
if pgrep -f "codium" > /dev/null if pgrep -f "codium" > /dev/null
then then
pkill -9 codium pkill -9 codium
fi fi
# remove VSCodium package if already exists
[ -f $HOME/VSCodium.AppImage ] && rm $HOME/VSCodium.AppImage [ -f $HOME/VSCodium.AppImage ] && rm $HOME/VSCodium.AppImage
# download the latest vscodium AppImage
wget -q --show-progress -i url -O VSCodium.AppImage wget -q --show-progress -i url -O VSCodium.AppImage
rm url rm url
# make it executable
chmod u+x VSCodium.AppImage chmod u+x VSCodium.AppImage
# moving it to the home folder
[ -f $HOME/VSCodium.AppImage ] || mv VSCodium.AppImage $HOME/VSCodium.AppImage [ -f $HOME/VSCodium.AppImage ] || mv VSCodium.AppImage $HOME/VSCodium.AppImage
echo ""
echo "VSCodium is now downloaded at $HOME/VSCodium.AppImage."