diff --git a/updateVSCodium.sh b/updateVSCodium.sh index 2e5f708..fe20133 100644 --- a/updateVSCodium.sh +++ b/updateVSCodium.sh @@ -14,15 +14,15 @@ then pkill -9 codium fi -if [ -x $HOME/.vscodium_scripts ] ; then # if the folder already exists (not the first run?) +if [ -x "$HOME"/.vscodium_scripts ] ; then # if the folder already exists (not the first run?) # go to the folder and clear it - cd $HOME/.vscodium_scripts - rm * + cd "$HOME/.vscodium_scripts" || exit + rm ./* else # if the folder isn't already created (first run?) # creating the folder - mkdir $HOME/.vscodium_scripts - cd $HOME/.vscodium_scripts + mkdir "$HOME/".vscodium_scripts + cd "$HOME"/.vscodium_scripts || exit echo "" echo "First run, adding commmands to shell, you will need to restart your shell" @@ -33,23 +33,27 @@ else # if the folder isn't already created (first run?) # to .bashrc (i assume it always exists, anyways if not this script is hard to start # because all the alias/abbr are using bash) - echo "" >> $HOME/.bashrc - echo "# Alias for Codium" >> $HOME/.bashrc - echo "alias updateCodium='bash \$HOME/.vscodium_scripts/updateVSCodium.sh'" >> $HOME/.bashrc - echo "alias code='\$HOME/.vscodium_scripts/VSCodium.AppImage --no-sandbox > /dev/null 2>&1 & disown'" >> $HOME/.bashrc - echo "" >> $HOME/.bashrc + { + echo "" + echo "# Alias for Codium" + echo "alias updateCodium='bash \$HOME/.vscodium_scripts/updateVSCodium.sh'" + echo "alias code='\$HOME/.vscodium_scripts/VSCodium.AppImage --no-sandbox > /dev/null 2>&1 & disown'" + echo "" + } >> "$HOME"/.bashrc # to .zshrc if exists - if [ -f $HOME/.zshrc ] ; then - echo "" >> $HOME/.zshrc - echo "# Alias for Codium" >> $HOME/.zshrc - echo "alias updateCodium='bash \$HOME/.vscodium_scripts/updateVSCodium.sh'" >> $HOME/.zshrc - echo "alias code='\$HOME/.vscodium_scripts/VSCodium.AppImage --no-sandbox > /dev/null 2>&1 & disown'" >> $HOME/.zshrc - echo "" >> $HOME/.zshrc + if [ -f "$HOME"/.zshrc ] ; then + { + echo "" + echo "# Alias for Codium" + echo "alias updateCodium='bash \$HOME/.vscodium_scripts/updateVSCodium.sh'" + echo "alias code='\$HOME/.vscodium_scripts/VSCodium.AppImage --no-sandbox > /dev/null 2>&1 & disown'" + echo "" + } >> "$HOME"/.zshrc fi # if config.fish exists - if [ -f $HOME/.config/fish/config.fish ] ; then + if [ -f "$HOME"/.config/fish/config.fish ] ; then fish -c "abbr updateCodium 'bash \$HOME/.vscodium_scripts/updateVSCodium.sh'" fish -c "abbr code 'bash \$HOME/.vscodium_scripts/VSCodium.AppImage --no-sandbox > /dev/null 2>&1 & disown'" fi