Installation common to a network

To provide a collection of scripts/commands to all users und computers in a network proceed as follows:

  • create a directory for the scripts at the fileserver
    • example: /magma; connect to the fossil console as owner of the fileserver and issue
      fsys main
      create /magma magma none d755
    • In this example a user/group named magma exists, which owns and maintains the scripts. As user in this group create a bin subdirectory of /magma/ from a normal shell: mkdir /magma/bin and fill it with the scripts and commands. make sure they are executable by the none group (or whatever group you want them to access).
  • Each user wanting to use them can mount the directory and bind it to /bin
    9fs $fileserver
    bind -a /n/$fileserver/magma/bin /bin
  • you can put these commands into the system wide profile /rc/lib/profile if you have installed this facility, see ../RcProfile

find

I often use find to simply browse a directory tree. Another common use is to locate a certain file The following find uses regular expressions (!) for filename matching.

Synopsis: find [dir] [-name regex]

#!/bin/rc
# /magma/bin/find
# LEG20061130
#
# very dumb find replacement

switch($#*){
case 0
        du -a | awk '{print $2}'
case 1
        du -a $1 | awk '{print $2}'
case 2
        if(~ $1 '-name') du -a | awk '/'$2'/{print $2}'
        if not  echo 'find [dir] [-name nam<<TableOfContents>>'
case 3
        if(~ $2 '-name') du -a  $1 | awk '/'$3'/{print $2}'
        if not echo 'find [dir] [-name nam<<TableOfContents>>'
case *
        echo 'find  [dir] [-name nam<<TableOfContents>>'
}

set

set prints the environment:

#!/bin/rc
# /magma/bin/set
# LEG20061130
#
# (pretty)print the environment
#
for (var in  `{cd /env/; ls}){
        if (test -r /env/$var){ 
                echo -n $var'='
                cat /env/$var
                echo
        }
}