+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Ultimate Member BFlurie's Avatar
    Join Date
    Oct 2001
    Location
    Hagerstown, Maryland
    Posts
    3,221

    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!

  2. #2
    Member gothic's Avatar
    Join Date
    Oct 2001
    Location
    Palatine, IL
    Posts
    375
    I believe you want a:

    if [ -f xinitrc.e ]; then
    ...


    -f checks if the file exists, and is a regular file.

  3. #3
    Ultimate Member BFlurie's Avatar
    Join Date
    Oct 2001
    Location
    Hagerstown, Maryland
    Posts
    3,221
    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.

  4. #4
    Member gothic's Avatar
    Join Date
    Oct 2001
    Location
    Palatine, IL
    Posts
    375
    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)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Recommended Sites: ResellerRatings Store Reviews