Other Help Topics :: Script help needed please



ok...well I wrote a different one in the meantime.  This was tested on an unmodified DSL 0.9.1:
Code Sample

#!/bin/sh

MNTPNT=/mnt/hda5  # mount point
DOCDIR="$MNTPNT/MyDocuments"  # name of linked directory
# name of the link will be generated from DOCDIR basename

mount_fail() {
echo "$MNTPNT failure - exiting"
exit 1
}
mount $MNTPNT && echo "$MNTPNT mounted" || mount_fail
[ -d "$DOCDIR" ] || mkdir -p "$DOCDIR"
ln -s "$DOCDIR" "$HOME/`basename $DOCDIR`"

The difference is basically that the link name is automatically generated depending on the name of the target directory, and it exits if the mount fails.
It still doesn't account for failure to write to the target partition.

I just tested your second script at boot and it appears that it is not creating the link if MyDocuments already exists on hda5. I want it create the link if it finds /mnt/hda5/MyDocuments.

The idea is that the first time I boot after doing a frugal install, it sees there is not a MyDocuments folder on hda5 so it creates one and then links it. On every boot after that, I just want it to create the link to the now existing /mnt/hda5/MyDocuments dir.

I hope this makes sense

Chris

Alright...I made a slight modification.  If the directory doesn't exist it is created.  The ln command is run either way.  My syntax was wrong....i thought it would link either way, but I guess not.
mikshaw -

We are getting close. It appears the third script ran OK but it placed the symlink in the root dir instead of /home/dsl

Chris

well that's weird.... "$HOME/`basename $DOCDIR`" should be /home/dsl/MyDocuments.  It's not really necessary to do that...I just thought it would be easier in case you wanted to change the directory.  Until I get back to it you could change the last line to
ln -s "$DOCDIR" /home/dsl/MyDocuments
or use the other script.

by the way, is it "MyDocuments" or "My Documents"?  A space in there might screw things up.

Next Page...
original here.