• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

bash

on

  • 2,042 views

Presentation I delivered that covered bash shell at Akron Linux User Group on 11/04/2010

Presentation I delivered that covered bash shell at Akron Linux User Group on 11/04/2010

Statistics

Views

Total Views
2,042
Views on SlideShare
2,041
Embed Views
1

Actions

Likes
1
Downloads
42
Comments
0

1 Embed 1

http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    bash bash Presentation Transcript

    • bash g 11/2010 Akron Linux User Group
    • macroprocessor program that expands text and symbols to create large expressions
    • shell macroprocessor to execute commands
    • shell standard IEEE POSIX and Open Group shell specification http://www.opengroup.org/onlinepubs/9699919799/nframe.html All of these mean the same thing: POSIX.1-2008 IEEE Std 1003.1-2008 Open Group Technical Standard Base Specifications Issue 7"
    • bash shell that interprets certain default commands and that provides programmatic tools to write custom commands that don't exist can be used interactively (user types commands) or non- interactively (commands saved in a file) respects POSIX.1-2008 standard maintained by Chet Ramey at the moment
    • bash documentation man bash man builtins man rbash man bashbug
    • bash feature summary 1/2 source:http://tiswww.case.edu/php/chet/bash/bash-intro.html editing and completion history and command re-entry job control functions and aliases arrays arithmetic ansi c quote expansion tilde expansion brace expansion substring capabilities
    • bash feature summary 2/2 source:http://tiswww.case.edu/php/chet/bash/bash-intro.html indirect variable expansion i/o capability control of built-in commands shell optional behavior prompt customization security directory stack posix mode internationalization command timing
    • bash breakdown of tasks read text (terminal, file, string) find words and operators parse tokens into commands expand certain tokens into lists filenames commands arguments handle redirections execute commands wait for completion, or not
    • bash: types of expansions tilde ~ variable str=abcdefgh; echo ${str:-3:2} command echo `date` process cmp < (echo "my life") <(echo "your life") arithmetic str=abcdefgh; echo ${str:((-3)):2} brace echo sp{el,il,al}l
    • bash modes default (non POSIX) POSIX
    • bash: POSIX mode set -o posix #now in POSIX mode
    • bash: POSIX mode example of variance: set builtin does not show you func defs
    • bash: POSIX mode subset of bash core no process substitution why use it?
    • readline bash + readline = productivity readline allows you to make edits to commands maintained by Chet as well typically gets updated along with bash
    • readline documentation man bash then type /READLINE <enter>
    • readline: take home C-b move back one C-f move forward one C-d delete character I'm on C-u undo last keystroke (infinitely) C-a go to begin of line C-e go to end of line M-f jump forward (word) M-b jump backward (word) C-l clear screen, but keep my line plenty more..
    • bash tips Execute your script, after marking it executable chmod +x myscript.sh; ./myscript.sh
    • bash tips Expansions! echo a{z,y,x}b
    • bash tips Append echo "This is me" > saveforlater echo "This is also me" >> saveforlater
    • bash tips Redirect output and error to different files . myprogram 1>myoutput 2>myerrors To the same file . myprogram >&alloutput . myprogram &>alloutput
    • bash tips First or last few lines head novel_that_i_started_but_didnt_finish tail novel_that_i_started_but_didnt_finish tail +1000 novel_that_i_started_but_didnt_finish tail +1000 --lines=2000 novel_that_i_started_but_didnt_finish
    • bash tips First or last few lines head novel_that_i_started_but_didnt_finish tail novel_that_i_started_but_didnt_finish tail +1000 novel_that_i_started_but_didnt_finish tail +1000 --lines=2000 novel_that_i_started_but_didnt_finish
    • bash tips accidental overwrites echo "Test String" > 1.file echo "Test String2" > 1.file set -o noclobber echo "Test String3" > 1.file echo "Test String3" >> 1.file cat 1.file
    • bash tips accidental overwrites echo "Test String" > 1.file echo "Test String2" > 1.file set -o noclobber echo "Test String3" > 1.file #no go echo "Test String3" >> 1.file #still works cat 1.file
    • bash tips incidental (conscious) overwrites echo "Test String" > 1.file echo "Test String2" > 1.file set -o noclobber echo "Test String3" >| 1.file #goes echo "Test String3" >> 1.file #still works cat 1.file
    • bash tips modern loops: for i in $(seq 1 10); do echo $i; done
    • bash tips loops from the past: for i in {1..10}; do echo $i; done
    • bash tips loops that are the most portable: for ((i=0; i<10; i++)); do echo $i; done
    • bash tips portable stdout: printf "%s" "short string"
    • bash tips what does the machine see: hexdump -C myfavoritebigfile
    • YOUR bash tips
    • bash online wiki: http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29 stallman: http://www.gnu.org/software/bash/ chet: http://tiswww.case.edu/php/chet/bash/bashtop.html austin: http://www.unix.org/single_unix_specification_v3/