Mylink C
Mylink C
main ()
{
link ("original.txt", "another.txt");
}
$ cat original.txt ...list original file.
this is a file.
$ ls -lG original.txt another.txt ...examine files before.
another.txt not found
-rw-r--r-- 1 glass 16 May 25 12:18 original.txt
$ ./mylink ...run the program.
$ ls -lG original.txt another.txt ...examine files after.
-rw-r--r-- 2 glass 16 May 25 12:18 another.txt
-rw-r--r-- 2 glass 16 May 25 12:18 original.txt
$ cat >> another.txt ...alter "another.txt".
hi
^D
$ ls -lG original.txt another.txt ...both labels reflect change.
-rw-r--r-- 2 glass 20 May 25 12:19 another.txt
-rw-r--r-- 2 glass 20 May 25 12:19 original.txt
$ rm original.txt ...remove original label.
$ ls -lG original.txt another.txt ...examine labels.
original.txt not found
-rw-r--r-- 1 glass 20 May 25 12:19 another.txt
$ cat another.txt ...list contents via other label.
this is a file.
hi
$ _