cs2042_Lecture3 - CS2042 - Unix Tools Lecture 3 Making BASH...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS2042 - Unix Tools Lecture 3 Making BASH Work For You Fall 2009 David Slater October 2nd, 2009 David Slater CS2042 - Unix Tools Last Time... Was everyone (who tried) able to log on to a UNIX system (csuglab or otherwise?) David Slater CS2042 - Unix Tools Shells Again There are been many different shells created for the UNIX environment over the years: bash- default shell for OSX and most Linux machines csh- default shell for BSD-based systems zsh- possibly the most fully-featured shell A thorough comparison of the features of many shells can be found here Since bash is the gold standard of shells and has more than enough features for this course, well stick with it. David Slater CS2042 - Unix Tools But the CSUG machines do not default to BASH :( The CSUG machines automatically put us into csh not bash. If you are already logged in to the server, just type bash More importantly we would like the server to automatically put us into bash when we login. We do this we editing the file /.login which gets executed each time you log in to the server and csh starts up. Start bash automatically Add the following line to the end of /.login if ( -f /bin/bash) exec /bin/bash --login David Slater CS2042 - Unix Tools Variables! BASH is a full-fledged programming language in adidtion to a handy shell. If you wanted to you could write a web server using BASH scripting. To get anything done we need variables! In BASH, all variables are preceded bya dollar sign ($). The contents of any variable can be listed using the echo command Two types of variables: Local and Environment. Example: echo $SHELL /bin/bash David Slater CS2042 - Unix Tools Environment Variables Environment Variables are used by the system to define aspects of operation. Most cannot (and should not) be changed by the user. The Shell passes environment variables to its child processes Examples: $Shell - which shell will be used by default $PATH - a list of directories to search for binaries $HOSTNAME - the hostname of the machine $HOME - current users home directory To get a list of all current environment variables type env New Environment Variable: To set a new environment variable use export slater@lil-puter: $ export X=3 slater@lil-puter: $ echo $X 3 Note: NO Spaces around the = sign....
View Full Document

Page1 / 28

cs2042_Lecture3 - CS2042 - Unix Tools Lecture 3 Making BASH...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online