- Open a terminal, and create the whoami.sh script:
#!/bin/bashVAR=$0echo "I was ran as: $VAR"
- Execute whoami.sh and observe what has happened:
$ bash whoami.sh
- Next, create a soft link to whoami.sh using the ln command:
$ ln -s whoami.sh ghosts-there-be.sh
- Next, run ls -la. Notice any differences?
ls -la ghosts-there-be.sh whoami.sh
- On to hard links, which are created this way using ln:
$ ln ghosts-there-be.sh gentle-ghosts-there-be.sh$ ln whoami.sh real-ghosts-there-be.sh
- Next, let's look at the difference in results when running the commands:
$ ls -la ghosts-there-be.sh whoami.sh real-ghosts-there-be.sh gentle-ghosts-there-be.sh lrwxrwxrwx 1 rbrash rbrash 18 Dec 12 15:07 gentle-ghosts-there-be.sh -> ghosts-there-be.sh ...