File: ln-install

package info (click to toggle)
swi-prolog 7.2.3%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 84,180 kB
  • ctags: 45,684
  • sloc: ansic: 330,358; perl: 268,104; sh: 6,795; java: 4,904; makefile: 4,561; cpp: 4,153; ruby: 1,594; yacc: 843; xml: 82; sed: 12; sql: 6
file content (40 lines) | stat: -rwxr-xr-x 524 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

mode=755
files=
target=
here=`pwd`

while [ "$#" != 0 ]; do
case "$1" in
	-m)	mode="$2"
		shift
		;;
	*)	if [ "$#" = 1 ]; then
		  target="$1"
		  done=yes
		else
		  case $1 in
		    /*) files="$files $1"
		        ;;
		    *)  files="$files $here/$1"
			;;
		  esac
		fi
		shift
		;;
esac
done
    
#echo files = $files
#echo target = $target

if [ -d "$target" ]; then
  for f in $files; do
    rm -f "$target"/`basename $f`
    (cd $target && ln -s $f .)
  done
else
  rm -f $target
  ln -s $files $target
fi