Web lists-archives.com

Re: Where kde saves user settings ?






On 03/19/2017 11:54 AM, John wrote:
Thanks for that Stephen. Having looked at the freedesktop spec that's useful and I am rather lost at that level. However I am stuck with BASH. I need help at times and it's always BASH. However I have seen some info on changing shells on the fly and going back to the default again. :-) That still looks pretty cryptic in places to me though. However if needs must. I'd prefer something for all xdg* in etc. Haven't a clue what the in would be.
John
-
John,

BASH is a superset of POSIX. pretty much anything that's POSIX shell works in BASH. I try to use the more restrictive POSIX set for compatibility and only use BASH extended features if it would be too painful to use POSIX only. (e.g. process substitution is just SOOOOO convenient)

So, just stick that snippet in a file (e.g. "xdg-vals") add "#!/bin/sh" or even "#!/bin/bash" to the top, make it executable (chmod 700 xdg-vals) and run it with ./xdg-vals.

so, for example:

#!/bin/bash
echo "[XDG Environment]"
while read var default; do
     printf "%24s = %s\n"  "${var}" "$(eval echo \${$var-${default}\(\*\)})"
done<<"EOF"
XDG_DATA_HOME       ${HOME}/.local/share
XDG_CONFIG_HOME     ${HOME}/.config
XDG_DATA_DIRS       /usr/local/share/:/usr/share/
XDG_CONFIG_DIRS     /etc/xdg
XDG_CACHE_HOME      ${HOME}/.cache
XDG_RUNTIME_DIR     /run/user/$(id -u)
XDG_SESSION_ID
XDG_SESSION_COOKIE
XDG_SESSION_TYPE
XDG_SESSION_CLASS
XDG_SESSION_DESKTOP
XDG_CURRENT_DESKTOP
XDG_SEAT
XDG_VTNR
XDG_DESKTOP_DIR     $HOME/Desktop
XDG_DOCUMENTS_DIR   $HOME/Documents
XDG_DOWNLOAD_DIR    $HOME/Downloads
XDG_MUSIC_DIR       $HOME/Music
XDG_PICTURES_DIR    $HOME/Pictures
XDG_PUBLICSHARE_DIR $HOME/Public
XDG_TEMPLATES_DIR   $HOME/Templates
XDG_VIDEOS_DIR      $HOME/Videos
EOF
echo "(*) indicates variable unset and a default value substituted"


--stephen