Ticket #5580: ghc-ver

File ghc-ver, 555 bytes (added by spl, 3 years ago)

Shell script to change Current symlink

Line 
1#!/bin/sh
2
3ECHO="/bin/echo"
4
5PROGNAME=`basename $0`
6
7if [ -z "$1" ];
8then
9  $ECHO "Usage: $PROGNAME <version>"
10  $ECHO "       $PROGNAME list"
11  exit 1
12fi
13
14VERSIONS_DIR="/Library/Frameworks/GHC.framework/Versions"
15
16if [ "$1" = "list" ];
17then
18  /usr/bin/find $VERSIONS_DIR -type d -depth 1 | xargs basename
19  exit 0
20fi
21
22CHOSEN_DIR="$VERSIONS_DIR/$1"
23
24$ECHO -n "Checking for $CHOSEN_DIR ... "
25
26if [ -d "$CHOSEN_DIR" ];
27then
28  rm $VERSIONS_DIR/Current
29  ln -sf $CHOSEN_DIR $VERSIONS_DIR/Current
30  $ECHO "Success!"
31else
32  $ECHO "Not found!"
33fi
34
35ghc --version