On Thursday 06 December 2001 00.45, Praise wrote:
Hi all,
I am just a beginner at shell scripting, but I need to make a script which: 1) hardlinks the content of a directory into another place 2) sets up the correct permissions of files in the other place
I have to do this because the user of my system do a mess when they want to share some file each other.
This is what I have tried:
#!/bin/sh #Syntax is supposed to be link.sh <directory>
case "$1" in --help) echo "Syntax is link.sh <dir>"; echo "If you want to share some files only, create the dir before this command"; exit 0 ;; *) export WHOAMI=`whoami`; mkdir /home/share/"$1"."$WHOAMI"/ ; ln ./"$1"/* /home/share/"$1"."$WHOAMI"/. ; chmod -R a+r /home/share/"$1"."$WHOAMI" ; chmod -R g-w /home/share/"$1"."$WHOAMI" ; chmod -R o-w /home/share/"$1"."$WHOAMI" ; chmod a+x /home/share/"$1"."$WHOAMI" ;
#Ok, it's not very recorsive for i in /home/share/"$1".$WHOAMI/* ; do [ -d "$i" ] && \ chmod a+x "$i" ; done ; #and there is no error handling exit 0 ;;
Somewhere around here there should probably be a line 'esac' to end the case statement.
exit 0; #############END
This script creates a mistake (syntax error near unexpected token exit). I cant work around it, any advice?
Praise
You do know you can't create hardlinks across partition boundaries, don't you? regards Anders