Tiny shell source

Tiny shell source

Post by Hrvoje Niks » Tue, 08 Nov 1994 23:03:19

[... nothing ...]

Now this was tiny! :)

| Hrvoje Niksic |If the novel writers knew how to + Login+e-mail:         |

| Student of electrical engineering  + they would ++++++++++++++++++++++++|
| University of Zagreb, Croatia      + tell jokes instead of writing novels


1. Tiny shell script to chase symbolic links to true file name

Hi all.

I wrote this shell script to ease some aspects of Informix
administration. I am cross posting it because it has general use. Here
it is:
---------------------------- CUT HERE ----------------------------------
# truename - chase down theain of symbolic links to obtain the true
#            name of a file
# Parameters: Name of a file or a list of file names
# Author: Jacob Salomon

# Date:   August 12 1998

# Shell function chase1 - Chase 1 file name to its true name
# Parameter: The file name
chase1 ()

  # Get link name, if any. If there is no symbolic link, the loop
  # below will not need to start.
  ls -ld $PFN | awk '{print $NF}' | read link_name
  until [ "$link_name" = "$PFN" ]   # chase it until no further links
    PFN=$link_name                  # Reset for next round of loop
    ls -ld $PFN | awk '{print $NF}'|read link_name
  echo $link_name
for FN in $*
  chase1 $FN | read TN          # Get any name this file might link to
# echo $FN : $TN
  echo $TN
---------------------------- CUT HERE ----------------------------------
   -- Jake (Retrospectively realizes there is no future in hindsight)
| The expedient performance of a task with excessive concern |
| regarding its duration-to-completion engenders a virtual   |
| certainty of diminished benefit therefrom.                 |
|          -- Benjamin Franklin (but he said it in 3 words)  |

2. mouse hangs

3. Shell for tiny terminal

4. broken network

5. Can any open source compiler convert C++ source to C source?

6. X with depth=4?

7. source code for the history mechanism that is provided by the csh command shell

8. Bash Shell Invocation Error

9. Windowing Korn Shell (wksh) source

10. Problems: source a shell script with positional parameters

11. Source of shell

12. Source code for shell that processes an asterisk as a special symbol

13. Where can I get the source code for the Bourne Shell?