简体   繁体   中英

Bash parameter substitution in xinitrc

I am trying to edit my .xinitrc file so that startx can run with a parameter telling it which window manager/desktop to use, but fall back to a default one if none are provided. .xinitrc is a shell script.

What I have used is this code:

desktop=${desktop:-startkde}
exec $desktop

The idea is that running startx desktop=fluxbox will launch a different desktop then the default provided, however this does not work. Can anyone see what I am doing wrong here?

Try:

desktop=fluxbox startx

Environment variables are set by putting them before the command name; everything after the command name is just arguments to the command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM