View Single Post
  #2   (View Single Post)  
Old 25th October 2008
vermaden's Avatar
vermaden vermaden is offline
Administrator
 
Join Date: Apr 2008
Location: pl_PL.lodz
Posts: 1,056
Default

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
__________________
religions, worst damnation of mankind
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds

Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.
vermaden's: links resources deviantart spreadbsd
Reply With Quote