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.
cd /
cd /etc/X11/xinit
if [ xinitrc.e ]; then
mv xinitrc xinitrc.k
mv xinitrc.e xinitrc
else mv xinitrc xinitrc.e
mv xinitrc.k xinitrc
fi
echo hey
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:
xinitrc
xinitrc.k
or
xinitrc
xinitrc.e
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.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)



LinkBack URL
About LinkBacks



Reply With Quote

So what we really need is for government to put certain maximum accuracy restrictions in place for bolt action rifles and magazine restrictions for semi auto's . Perhaps we can add to that...
The perfect gift for an aspiring...