Dr. Mark Humphrys

School of Computing. Dublin City University.

Home      Blog      Teaching      Research      Contact

My big idea: Ancient Brain


CA114      CA170

CA668      CA669      Projects

Lab - Shell

Shell scripts setup

  1. make a "bin" directory for your scripts, if such does not exist:
    • mkdir bin

  2. hide directory from others
    • chmod go-rwx bin

  3. Check $HOME/bin is in the PATH. (How?)

  4. With openSUSE, all you need do is make $HOME/bin, log off, log on again.

  5. We will edit Shell scripts in $HOME/bin

Exercise: d

  1. Make a program called "d" - detailed ls
    • ls -l $*
    • $* means all arguments that are passed to this script

  2. make prog executable
    • chmod +x d

  3. Run it.
    • d

Exercise: gnews

Another simple exercise:

Make a shell script called gnews.

gnews someargument
It uses wget to grab today's news from, say, RTE.
It then searches the page (using grep) for the argument.

ancientbrain.com      w2mind.org      humphrysfamilytree.com

On the Internet since 1987.

Wikipedia: Sometimes I link to Wikipedia. I have written something In defence of Wikipedia. It is often a useful starting point but you cannot trust it. Linking to it is like linking to a Google search. A starting point, not a destination. I automatically highlight in red all links to Wikipedia and Google search and other possibly-unreliable user-generated content.