sh: Fix touch error on startup

The xdg-compliance function would check on shell startup if we have a
file mentioned by 'PYTHONSTARTUP' and create it if not.

However, if there is no env var in the shell calling for this at all it
would still try to create a file at an 'empty' path, so this obviously
won't work.

Added a check that we even have the variable to do work.
This commit is contained in:
Marty Oehme 2025-02-25 23:27:57 +01:00
parent f252c628ec
commit e604e34329
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -54,7 +54,7 @@ export LESSHISTFILE="XDG_STATE_HOME/lesshst"
export MPLAYER_HOME="$XDG_CONFIG_HOME/mplayer"
export NODE_REPL_HISTORY="$XDG_STATE_HOME/node_repl_history"
export NVM_DIR="$XDG_DATA_HOME/nvm"
if [ ! -e "$PYTHONSTARTUP" ]; then
if [ -n "$PYTHONSTARTUP" ] && [ ! -e "$PYTHONSTARTUP" ]; then
mkdir -p "$XDG_CONFIG_HOME/python"
touch "$PYTHONSTARTUP"
fi