Hey Alvaro......looks great.  I love it when speakers use real world
examples of something useful.  Don't know if I'll get to go to the
presentation but your outline taught me stuff I didn't know.
Cleve




On Sun, 2002-11-03 at 18:44, Alvaro Zuniga wrote:
> Hello guys:
> Here is a hand out for the shell programming part of the presentation.
> It is a brief overview for those new to the subject. I will elaborate on
> the scripts which I believe are sufficient to show the power of shell
> scripting. I will probably compare it to applescript and windows
> scripting.
> 
> I will have three more, one about programming languages and utilities
> supported. I will write a little interface that will allow a web based
> interaction with the system for commands such that yield appropriate
> output.
> 
> Another about some editors. I will probably compare bluefish, glimmer,
> and some other one I have seen which work just about the same. This can
> show the power of open source because I think these applications share
> the same code.
> 
> Another about anjuta and quanta to show internet and desktop
> development. I have been playing with kdevelp and seems really cool. It
> did not know you could use it for general programming. I will probably
> use that as well.
> 
> That is going to be all in general. I would love to talk about cvs but I
> do not know anything about it and I do not think I can learn about it
> before the presentation. If anyone else would like to do that I think it
> would be beneficial.
> 
> 
> 
> ___________________________________________________________________
> 
> Shell Programming 
>  
> Definition 
>  
> A shell is a program serving as an interface between user and operating
> system to execute commands interactively or automatically. 
>  
> Types 
>  
> There is a wide variety of shells. Their main differences are syntax and
> features. Here is a list of shells included with Red Hat Distribution.
>  
> ash           A small shell (sh-like) 
> ash.static            A version of ash not dependent on software libraries 
> bash          The Bourne Again Shell is based on the Bourne shell 
> bash2         Newer version (2.03) of the Bourne Again Shell 
> ksh           The public-domain Korn shell 
> pdksh         A symbolic link to ksh 
> rsh           The restricted shell (for network operation) 
> sh            A symbolic link to bash 
> tcsh          A csh-compatible shell plus additional features 
> zsh           A compatible csh, ksh, and sh shell 
>  
> Usage 
>  
> To customize user session: set home directory, mail spool, path of
> executables, reminders, etc 
>  
> To execute commands: the shell can execute built-in commands and
> operating system commands. 
>  
> To program commands: a list of commands compiled into a text file. 
>  
> Example 1 
> 
>  
> $                             ( default prompt  waiting for commands) 
> [EMAIL PROTECTED] $   ( customized prompt ) 
>  
> 
> Example 2
> 
> 
> $ cat .bashrc         ( executing a command ) 
> # .bashrc 
>  
> # User specific aliases and functions 
> alias ls="ls -h --color" 
>  
> alias cp="cp -i" 
> alias rm="rm -i" 
> alias mv="mv -i" 
>  
> alias df="df -h" 
>  
> alias vi=vim 
> alias mpg="mpg321 -Z" 
> # Source global definitions 
> if [ -f /etc/bashrc ]; then 
>         . /etc/bashrc 
> fi 
> $                             ( end of output/back to prompt ) 
>  
> Features ( bash ) 
>  
> <tab>         general completion of the text at prompt 
> >, >>         Output Redirection  
> <, <<         Input Redirection 
> !                     Pipe output 
> &             Run process in background 
> ;                     Separate commands on the same line 
> *, ?          Wild cards 
> $container    use container for variable 
> kill          Terminate running jobs 
> alias         Command substitution 
> for, while            Iteration statements 
> function( )   Custom functions 
>  
> For details on bash visit 
>  
> http://www.gnu.org/software/bash/bash.html 
>  
> For Shell Programming 
>  
> http://wihok.8m.com/linux/rhl13.htm#E68E99 
>  
> The importance of shell programming 
>  
> Shell languages are powerful and easy to learn. 
>  
> Imagine having rotate the logs of a webserver manually, no problem: 
>  
> #!/usr/bin/bash 
> # script to rotate logs of www.oursite.net 
>  
> # getting the current date and formatting MonthDayYear 
>       date=$( date "+%m%d%Y") 
>  
> #changing the current directory of the current log and renaming the file
>       cd /usr/www/logs/www.oursite.com 
>       mv access_log access_log.$date 
>  
> #restart the web server therefore creating a new log file 
> /usr/www/bin/apachectl restart 
>  
> #a large log might be desirable 
>       cat access_log.$date >> fulllog 
>  
> #placing the log for viewing 
>       mv access_log.$date /usr/www/hosts/www.oursite.com/stats/logfiles/ 
>  
> # compressing the file 
> # note that the full path of is required otherwise cd to the directory
> could do the job 
>       gzip /usr/www.hosts/www.oursite.com/stats/logfiles/access_log.$date 
>  
> #end of script 
>  
> Rewriting this script with a programming language such as c would be
> lengthier and more complex. 
>  
> Scripts, like any other command in Linux can be set to execute
> automatically at any given time when used in combination with a utility
> such as cron. 
> 
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://oxygen.nocdirect.com/mailman/listinfo/general_brlug.net



Reply via email to