View Single Post
  #4   (View Single Post)  
Old 25th October 2008
Gabe_G23 Gabe_G23 is offline
New User
 
Join Date: Oct 2008
Posts: 5
Default

Quote:
Originally Posted by vermaden View Post
Why use bash(1) wne you can do the same with plain POSIX sh(1)

Code:
#! /bin/sh

clear
echo Choose the environment to start:
echo "1. gnome"
echo "2. wmaker"
echo -n "choice: "
read OPT

case $OPT in
  (1)
    echo "/usr/local/bin/gnome-session" > ~/.xinitrc && startx
    exit 0
    ;;
  (2)
    echo "exec wmaker" > ~/.xinitrc && startx
    exit 0
    ;;
  (*)
    echo "ERROR: wrong option"
    exit 1
    ;;
esac
Always use sh(1) for scripts, bash(1) provides some fancy out of standart syntax and arrays. but for 99% cases its useless and can be achieved in plain sh(1).

... and welcome to bsdforums.org ... I mean daemonforums.org
Haha. Thank you very much!

I was looking for an implementation in sh, seems like it found me.
Reply With Quote