old-www/LDP/Bash-Beginners-Guide/html/sect_01_07.html

276 lines
4.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Exercises</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Bash Guide for Beginners"
HREF="index.html"><LINK
REL="UP"
TITLE="Bash and Bash scripts"
HREF="chap_01.html"><LINK
REL="PREVIOUS"
TITLE="Summary"
HREF="sect_01_06.html"><LINK
REL="NEXT"
TITLE="Writing and debugging scripts"
HREF="chap_02.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Bash Guide for Beginners</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sect_01_06.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 1. Bash and Bash scripts</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="chap_02.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="sect_01_07"
></A
>1.7. Exercises</H1
><P
>These are some exercises to warm you up for the next chapter:</P
><P
></P
><OL
TYPE="1"
><LI
><P
>Where is the <B
CLASS="command"
>bash</B
> program located on your system?</P
></LI
><LI
><P
>Use the <TT
CLASS="option"
>--version</TT
> option to find out which version you are running.</P
></LI
><LI
><P
>Which shell configuration files are read when you login to your system using the graphical user interface and then opening a terminal window?</P
></LI
><LI
><P
>Are the following shells interactive shells? Are they login shells?</P
><P
></P
><UL
><LI
><P
>A shell opened by clicking on the background of your graphical desktop, selecting <SPAN
CLASS="QUOTE"
>"Terminal"</SPAN
> or such from a menu.</P
></LI
><LI
><P
>A shell that you get after issuing the command <B
CLASS="command"
>ssh <TT
CLASS="parameter"
><I
>localhost</I
></TT
></B
>.</P
></LI
><LI
><P
>A shell that you get when logging in to the console in text mode.</P
></LI
><LI
><P
>A shell obtained by the command <B
CLASS="command"
>xterm &#38;</B
>.</P
></LI
><LI
><P
>A shell opened by the <B
CLASS="command"
>mysystem.sh</B
> script.</P
></LI
><LI
><P
>A shell that you get on a remote host, for which you didn't have to give the login and/or password because you use SSH and maybe SSH keys.</P
></LI
></UL
></LI
><LI
><P
>Can you explain why <B
CLASS="command"
>bash</B
> does not exit when you type <B
CLASS="keycap"
>Ctrl</B
>+<B
CLASS="keycap"
>C</B
> on the command line?</P
></LI
><LI
><P
>Display directory stack content.</P
></LI
><LI
><P
>If it is not yet the case, set your prompt so that it displays your location in the file system hierarchy, for instance add this line to <TT
CLASS="filename"
>~/.bashrc</TT
>:</P
><P
><B
CLASS="command"
>export <TT
CLASS="varname"
>PS1</TT
>="<TT
CLASS="parameter"
><I
>\u@\h \w&#62; </I
></TT
>"</B
> </P
></LI
><LI
><P
>Display hashed commands for your current shell session.</P
></LI
><LI
><P
>How many processes are currently running on your system? Use <B
CLASS="command"
>ps</B
> and <B
CLASS="command"
>wc</B
>, the first line of output of <B
CLASS="command"
>ps</B
> is not a process!</P
></LI
><LI
><P
>How to display the system hostname? Only the name, nothing more!</P
></LI
></OL
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sect_01_06.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="chap_02.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Summary</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="chap_01.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Writing and debugging scripts</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>