The experiences of an Australian student who uses Linux.
Cover all topics from shell scripts to monopolies and reviews to political comments.
Cover all topics from shell scripts to monopolies and reviews to political comments.
Better than an xmessage choice window
Posted 04-23-2010 at 08:05 PM by William (Dthdealer)
Regarding my earlier post about .xinit scripts
This is my current setup, probably a better option. I simply pass options as what I want to execute or just run startx without any options for my normal session including window manager.
Breaking it down
if [ -z $1 ]
Checks whether anything is passed to the startx command. $1 is the first thing passed, so if I wrote startx tremulous then $1 would have the content 'tremulous'. For all consecutive options passed, the number increases, putting this in the format startx $1 $2 $3 $4 $5 etc.
The [ and ] characters are shorthand for the test shell command. See the manpage for details on it.
Here the -z option checks whether the string ( $1 ) is zero-length. If it is, then the user has just written startx without any options. Else it goes on.
# Pass any options of this script
$1 $2 $3 $4 $5 $6 $7 $8 $9
Here the options after startx are executed. For example if I wrote startx tremulous --anoption value the $1,$2 and $3 variables would substitute in ' tremulous --anoption value ' and execute it as if I had written in in a terminal, but in Xorg.
This is my current setup, probably a better option. I simply pass options as what I want to execute or just run startx without any options for my normal session including window manager.
Code:
#!/bin/sh # Anything to run only once and beforehand xmodmap "/home/whales/.Xmodmap" xbattbar -s acpi_xbattbar -t 3 & ~/script/shell/dayfortune & if [ -z $1 ] then # Start normal session exec .fluxbox/startup # Script ends before this comment as the EXEC command kills after completion fi # Pass any options of this script $1 $2 $3 $4 $5 $6 $7 $8 $9 exit $?
if [ -z $1 ]
Checks whether anything is passed to the startx command. $1 is the first thing passed, so if I wrote startx tremulous then $1 would have the content 'tremulous'. For all consecutive options passed, the number increases, putting this in the format startx $1 $2 $3 $4 $5 etc.
The [ and ] characters are shorthand for the test shell command. See the manpage for details on it.
Here the -z option checks whether the string ( $1 ) is zero-length. If it is, then the user has just written startx without any options. Else it goes on.
# Pass any options of this script
$1 $2 $3 $4 $5 $6 $7 $8 $9
Here the options after startx are executed. For example if I wrote startx tremulous --anoption value the $1,$2 and $3 variables would substitute in ' tremulous --anoption value ' and execute it as if I had written in in a terminal, but in Xorg.
Total Comments 0