Thread: Simple bash script won't work
November 18th, 2002, 09:19 AM #1
Simple bash script won't work
I've wasted too much time on this. Trying to write a simple bash script renaming files to exchange windows managers (KDE & Enlight) when startx is typed. The script "single-clicks" this operation
from the WM I'm currently in.
if [ xinitrc.e ]; then
mv xinitrc xinitrc.k
mv xinitrc.e xinitrc
else mv xinitrc xinitrc.e
mv xinitrc.k xinitrc
It won't work. xinitrc.e is for Enlight, xinitrc.k for KDE. The file that startx looks for has to be named xinitrc. The files in /xinit will exchange between:
Help! Help me Mr. Tudor!
November 18th, 2002, 11:56 AM #2
I believe you want a:
if [ -f xinitrc.e ]; then
-f checks if the file exists, and is a regular file.
November 18th, 2002, 01:24 PM #3
That did it, thanks. I looked thru some bash command stuff, but that wasn't documented. Any off-hand links for better bash-command documentation anyone?
PS -- doing this 'cause KDM session manager takes memory and want to dump it but still have an easier way to change WM choices than editing the xinitrc file everytime.
November 18th, 2002, 09:46 PM #4
Depending on your system, you might be able to have a ~/.wm_style file that will be checked to see which Windowmanager to load up.
Anyway.. if you do a 'man bash', there is a lot of stuff doced in there... But I always just looked at scripts that were on the system for help.
I imagine if you do a search for 'bash scripting' in google or something, you'd get a lot of helpful info.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)