bash$ chmod 700 datedir.sh
Now that you have set the permissions so that the shell script can execute, let's run it:
bash$ ./datedir.sh
Since this file wrote all of its contents to another file called logfile, we can see the contents of the file by using cat to view it:
bash$ cat logfile Wed Mar 20 17:39:54 HST 2002 total 64 drwx------ 5 bob bob 4096 Mar 20 17:39 . drwxr-xr-x 5 root root 4096 Feb 26 10:33 .. -rw------- 1 bob bob 416 Mar 19 16:34 .bash_history -rw-r--r-- 1 bob bob 24 Feb 26 10:33 .bash_logout -rw-r--r-- 1 bob bob 224 Feb 26 10:33 .bash_profile -rw-r--r-- 1 bob bob 124 Feb 26 10:33 .bashrc -rw-r--r-- 1 bob bob 5450 Feb 26 10:33 .canna -rwx------ 1 bob bob 33 Mar 20 17:39 datedir.sh drwxr-xr-x 2 bob bob 4096 Feb 26 10:33 Desktop -rw-r--r-- 1 bob bob 747 Feb 26 10:33 .emacs drwxr-xr-x 3 bob bob 4096 Feb 26 10:33 .kde -rw-r--r-- 1 bob bob 29 Mar 20 17:39 logfile -rw-r--r-- 1 bob bob 3728 Feb 26 10:33 .screenrc -r--r--r-- 1 bob bob 1019 Feb 26 10:33 .wl drwx------ 2 bob root 4096 Mar 19 15:38 .xauth
You can see that this file contains the date as the first line, then the directory listing is appended onto the end. You can change this shell script so that it does a backup or many other things.