Mastering Shell Programming: Part III Overview

shell programming part iii n.w
1 / 6
Embed
Share

Explore Chapter 10 of the Shell Programming Part III readings, covering topics such as configuration files, automation scripts, and large projects. Dive into examples and reading assignments to enhance your shell scripting skills.

  • Shell Programming
  • Automation Scripts
  • Configuration Files
  • Large Projects
  • Regular Expressions

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Shell Programming: Part III Readings: Chapter 10

  2. Example: /etc/profile See examples/shell/etc_profile if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then # The file bash.bashrc already sets the default PS1. # PS1='\h:\w\$ ' if [ -f /etc/bash.bashrc ]; then . /etc/bash.bashrc fi else if [ "`id -u`" -eq 0 ]; then PS1='# ' else PS1='$ ' fi fi fi

  3. /etc/profile # The default umask is now handled by pam_umask. # See pam_umask(8) and /etc/login.defs. if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then . $i fi done unset i fi

  4. Example: Automate Some Tasks See examples/shell/parse_all.sh (and parse_all_data.txt) for ((j=1; j <= $limit; ++j)); do name="test${i}_${j}" fname="$name.tar" echo -n "$fname:" cd $dir tar xvf $fname > /dev/null cd $odir #echo $(pwd) mypeer=$(ls $dir/$name/myPeers_*) path=$(ls $dir/$name/dataRequestPath_*) response=$(ls $dir/$name/respondedRequest_*) #echo $mypeer #echo $path #echo $response perl traceback.v2.pl $mypeer $response $path rm -rf $dir/$name done done #!/bin/bash # for 1 to 9, we have 10 tests dir="data/FreenetExperimentsResult1" odir=$(pwd) for ((i=1; i <= 10; ++i)); do if (($i == 10)); then limit=6 else limit=10 fi

  5. Example Many large projects use shell scripts Update program of the Freenet project See examples/shell/update.sh Ardupilot https://github.com/ArduPilot/ardupilot/tree/master/Tools/s cripts

  6. Reading Assignment Appendix A (regular expressions)

More Related Content