assign3__DIY - Chapter 13 Do It Yourself hands-on lab SHELL SCRIPTS You can test and refine almost all commands on the command line before placing those

assign3__DIY - Chapter 13 Do It Yourself hands-on lab SHELL...

This preview shows page 1 - 3 out of 3 pages.

Chapter 13 – Do It Yourself hands-on labSHELL SCRIPTSYou can test and refine almost all commands on the command line before placing those commands in a script. This way you know those are syntactically correct. Sometimes in a script the output of a command may be redirected to a file. For instance try this sequence to see how the output content and location changes.ls –lR /etc ls –lR /etc | grep permission ls –lR /etc > whatsInEtc ls –lR /etc > whatsInEtc 2> errors ls –lR /etc > whatsInEtc 2> /dev/null ls –lR /etc > allOfEtc 2>&1 The steps which we did in class to create an execute a simple script.$ nano statscript#! /bin/shclearcd ; lsdu –skdatecal 12 1982 <SAVE THE FILE & EXIT NANO>$ ls -l statscript$ chmod 740 statscript $ ./statscriptQUOTING SPECIAL CHARACTERSecho $PATHecho “$PATH”echo ‘$PATH’echo \$PATHOK, let’s get a bit advanced (things you may see if you look in OS scripts). I want to generate the list of all scripts in /etc/init.d1 | P a g e
Background image
cd /etc/init.dfile *file * | grep scriptfile *
Background image
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Fall '16
  • Anonamous
  • scripting language, Unix SUS2008 utilities, Standard Unix programs, appropriate grep command

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes