Dear All, I just tried making a symlink to sage and it broke because it defaults to using $0 to work out where SAGE_DIR is. I'd like to propose a small change that allows symlinks to be used:
--------------------------- THE FILE: is the shell script called sage in the root of the install tree and which starts: #!/bin/sh # Set SAGE_ROOT to the location of the sage install. SAGE_ROOT="....." CUR="`pwd`" # save the current directory, so can change back after startup if [ "$SAGE_ROOT" = "....." ]; then SAGE_ROOT=`echo "$0" | sed -e 's/....$//g'` ----------------------------- BEFORE: The line I'd like to change is: SAGE_ROOT=`echo "$0" | sed -e 's/....$//g'` ---------------------------- AFTER: SAGE_ROOT=`readlink -f "$0"` 2>/dev/null || \ SAGE_ROOT=`realpath "$0"` 2>/dev/null || \ SAGE_ROOT="$0" SAGE_ROOT="${SAGE_ROOT%/*}/" -------------------------- DISCUSSION: readlink -f and realpath do the same thing - they get a clean path free of relative components and symlinks. The reason for trying both is that some systems have only the one or the other. Trying raw $0 is there as a last resort just in case. Don't want to break any existing installs! The final line does -almost- the same as the sed. The sed removes four characters (sage), the new code removes the file part of the path. Debatable but it's a bit quicker than spawning a sed process and allows for name changes. You never know.. it might become fennel. All right, this part of the argument is pretty weak! But the upside is that I can now make symlinks to sage and everything works dandy, which it didn't before. Have fun! And sorry about not using [code] tags .. I couldn't find the button! (wimp) Regards, Max (new to this forum) --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---