Free Essay

C Shell

In: Computers and Technology

Submitted By jennn
Words 2049
Pages 9
ROEL A. GUTAY
BSIT 4-3
201010981
PROJECT IN PROGRAMMING LANGUAGES
C SHELL

HISTORY :
The C shell (csh or the improved version, tcsh, on most machines) is aUnix shell that was created by Bill Joy while a graduate student atUniversity of California, Berkeley in the late 1970s. It has been distributed widely, beginning with the 2BSD release of the BSD Unix system that Joy began distributing in 1978. Other early contributors to the ideas or the code were Michael Ubell, Eric Allman, Mike O'Brien and Jim Kulp.
The C shell is a command processor typically run in a text window, allowing the user to type commands. The C shell can also read commands from a file, called a script. Like all Unix shells, it supports filename wildcarding, piping, here documents, command substitution,variables and control structures for condition-testing and iteration. What differentiated the C shell from others, especially in the 1980s, were its interactive features and overall style. Its new features made it easier and faster to use. The overall style of the language looked more like C and was seen as more readable.
On many systems, such as Mac OS X and Red Hat Linux, csh is actually tcsh, an improved version of csh. One file containing the tcsh executable has links to it as both "csh" and "tcsh" so that either name refers to the same improved version of the C shell.
On Debian, Ubuntu, and their derivatives, there are two different packages: csh and tcsh. The former is based on the original BSD version of csh and the latter is the improved tcsh. tcsh added filename and command completion and command line editing concepts borrowed from the Tenex system, which is the source of the "t". Because it only added functionality and did not change what was there, tcsh remained backward compatible with the original C shell. Though it started as a side branch from the original source tree Joy had created, tcsh is now the main branch for ongoing development. tcsh is very stable but new releases continue to appear roughly once a year, consisting mostly of minor bug fixes.

ADVANTAGES:
• Do you ever find that you often do a number of UNIX commands together and you would like to "bundle" them up into one name? You can do this, in effect,creating a brand new command. Other operating systems permit this convenience,most notably MS-DOS, which calls such files "BAT" or batch files. In UNIX,such a file is called a shell script.
• the C shell should be better for interactive use. It introduced numerous new features that new features proved very popular, and many of them have since been copied by other Unix shells.made it easier, faster and more friendly to use by typing commands at a terminal. Users could get things done with a lot fewer keystrokes and it ran faster. The most significant of these new features were the history and editing mechanisms, aliases, directory stacks, tilde notation, cdpath, job control and path hashing. These

• The C shell operates one line at a time. Each line is tokenized into a set of words separated by spaces or other characters with special meaning, including parentheses, piping and input/output redirection operators, semicolons, and ampersands.

DISADVANTEGES
• The Ad Hoc Parser

The biggest problem of the C shell (and TCSH) it its ad hoc parser. Now this information won't make you immediately switch shells. But it's the biggest reason to do so. Many of the other items listed are based on this problem. Perhaps I should elaborate. The parser is the code that converts the shell commands into variables, expressions, strings, etc. High-quality programs have a full-fledged parser that converts the input into tokens, verifies the tokens are in the right order, and then executes the tokens. The Bourne shell even as an option to parse a file, but don't execute anything. So you can syntax check a file without executing it.

• Multiple-line quoting difficult

The C shell complaints if strings are longer than a line. If you are typing at a terminal, and only type one quote, it's nice to have an error instead of a strange prompt. However, for shell programming - it stinks like a bloated skunk.

• Quoting can be confusing and inconsistent

The Bourne shell has three types of quotes:

"........" - only $, `, and \ are special. '.......' - Nothing is special (this includes the backslash) \. - The next character is not special (Exception: a newline)

That's it. Very few exceptions. The C shell is another matter. What works and what doesn't is no longer simple and easy to understand.

• If/while/foreach/read cannot use redirection

The Bourne shell allows complex commands to be combined with pipes. The C shell doesn't. Suppose you want to choose an argument to grep.

• Getting input a line at a time

Suppose you want to read one line from a file. This simple task is very difficult for the C shell. The C shell provides one way to read a line:

% set ans = $<

The trouble is - this ALWAYS reads from standard input. If a terminal is attached to standard input, then it reads from the terminal. If a file is attached to the script, then it reads the file.

But what do you do if you want to specify the filename in the middle of the script? You can use "head -1" to get a line. but how do you read the next line? You can create a temporary file, and read and delete the first line. How ugly and extremely inefficient. On a scale of 1 to 10, it scores -1000.

Now what if you want to read a file, and ask the user something during this? As an example - suppose you want to read a list of filenames from a pipe, and ask the user what to do with some of them? Can't do this with the C shell - $< reads from standard input. Always. The Bourne shell does allow this. Simply use

$ read ans file means stdout will be written to file, overwriting it if it exists, and creating it if it doesn't. Errors still come to the shell window.
>& file means both stdout and stderr will be written to file, overwriting it if it exists, and creating it if it doesn't.
>> file means stdout will be appended at the end of file.
>>& file means both stdout and stderr will be appended at the end of file.
< file means stdin will be read from file.
&2 Year \"$year\" out of my range exit 127 fi

etc...

# ok, you have the number of days since Jan 1, ...

case `expr $days % 7` in 0) echo Mon;; 1) echo Tue;;

etc...
Error messages should appear on stderr not on stdout! Output should appear on stdout. As for input/output dialogue: # give the fellow a chance to quit

if tty -s ; then echo This will remove all files in $* since ... echo $n Ok to procede? $c; read ans case "$ans" in n*|N*) echo File purge abandoned; exit 0 ;; esac RM="rm -rfi" else RM="rm -rf" fi
Note: this code behaves differently if there's a user to communicate with (ie. if the standard input is a tty rather than a pipe, or file, or etc. See tty(1)).
Language Constructs
For loop iteration
Substitute values for variable and perform task: for variable in word ... do command done
For example: for i in `cat $LOGS` do mv $i $i.$TODAY cp /dev/null $i chmod 664 $i done
Alternatively you may see: for variable in word ...; do command; done
• Case
Switch to statements depending on pattern match case word in [ pattern [ | pattern ... ] ) command ;; ] ... esac
For example:

case "$year" in

[0-9][0-9]) year=19${year} years=`expr $year - 1901` ;; [0-9][0-9][0-9][0-9]) years=`expr $year - 1901` ;; *) echo 1>&2 Year \"$year\" out of range ... exit 127 ;; esac
• Conditional Execution
Test exit status of command and branch if command then command [ else command ] fi
For example: if [ $# -ne 3 ]; then echo 1>&2 Usage: $0 19 Oct 91 exit 127 fi
Alternatively you may see: if command; then command; [ else command; ] fi
• While/Until Iteration
Repeat task while command returns good exit status. {while | until} command do command done
For example: # for each argument mentioned, purge that directory

while [ $# -ge 1 ]; do _purge $1 shift done
Alternatively you may see: while command; do command; done
• Variables
Variables are sequences of letters, digits, or underscores beginning with a letter or underscore. To get the contents of a variable you must prepend the name with a $.
Numeric variables (eg. like $1, etc.) are positional vari- ables for argument communication. o Variable Assignment
Assign a value to a variable by variable=value. For example: PATH=/usr/ucb:/usr/bin:/bin; export PATH or TODAY=`(set \`date\`; echo $1)` o Exporting Variables
Variables are not exported to children unless explicitly marked. # We MUST have a DISPLAY environment variable

if [ "$DISPLAY" = "" ]; then if tty -s ; then echo "DISPLAY (`hostname`:0.0)? \c"; read DISPLAY fi if [ "$DISPLAY" = "" ]; then DISPLAY=`hostname`:0.0 fi export DISPLAY fi
Likewise, for variables like the PRINTER which you want hon- ored by lpr(1). From a user's .profile: PRINTER=PostScript; export PRINTER
Note: that the Cshell exports all environment variables. o Referencing Variables
Use $variable (or, if necessary, ${variable}) to reference the value. # Most user's have a /bin of their own

if [ "$USER" != "root" ]; then PATH=$HOME/bin:$PATH else PATH=/etc:/usr/etc:$PATH fi
The braces are required for concatenation constructs.
$p_01
The value of the variable "p_01".
${p}_01
The value of the variable "p" with "_01" pasted onto the end. o Conditional Reference o ${variable-word}
If the variable has been set, use it's value, else use word.
POSTSCRIPT=${POSTSCRIPT-PostScript};
export POSTSCRIPT

${variable:-word}
If the variable has been set and is not null, use it's value, else use word.
These are useful constructions for honoring the user envi- ronment. Ie. the user of the script can override variable assignments. Cf. programs like lpr(1) honor the PRINTER environment variable, you can do the same trick with your shell scripts.
${variable:?word}
If variable is set use it's value, else print out word and exit. Useful for bailing out. o Arguments
Command line arguments to shell scripts are positional vari- ables:
$0, $1, ...
The command and arguments. With $0 the command and the rest the arguments.
$#
The number of arguments.
$*, $@
All the arguments as a blank separated string. Watch out for "$*" vs. "$@".
And, some commands: shift Shift the postional variables down one and decrement number of arguments. set arg arg ...
Set the positional variables to the argument list.
Command line parsing uses shift: # parse argument list

while [ $# -ge 1 ]; do case $1 in process arguments... esac shift done
A use of the set command: # figure out what day it is

TODAY=`(set \`date\`; echo $1)`

cd $SPOOL

for i in `cat $LOGS` do mv $i $i.$TODAY cp /dev/null $i chmod 664 $i done o Special Variables o $$
Current process id. This is very useful for constructing temporary files. tmp=/tmp/cal0$$ trap "rm -f $tmp /tmp/cal1$$ /tmp/cal2$$" trap exit 1 2 13 15 /usr/lib/calprog >$tmp

$?
The exit status of the last command. $command # Run target file if no errors and ...

if [ $? -eq 0 ] then etc... fi

• Quotes/Special Characters
Special characters to terminate words: ; & ( ) | ^ < > new-line space tab
These are for command sequences, background jobs, etc. To quote any of these use a backslash (\) or bracket with quote marks ("" or '').
Single Quotes
Within single quotes all characters are quoted -- including the backslash. The result is one word.

grep :${gid}: /etc/group | awk -F: '{print $1}'
Double Quotes
Within double quotes you have variable subsitution (ie. the dollar sign is interpreted) but no file name generation (ie. * and ? are quoted). The result is one word. if [ ! "${parent}" ]; then parent=${people}/${group}/${user} fi
Back Quotes
Back quotes mean run the command and substitute the output.

if [ "`echo -n`" = "-n" ]; then n="" c="\c" else n="-n" c="" fi and TODAY=`(set \`date\`; echo $1)`
Sample codes
The following csh code will print welcome message five times on screen: #!/bin/csh # demoloop.csh - Sample loop script set j = 1 while ( $j

Similar Documents

Free Essay

Bash for Beginners

...Bash Guide for Beginners Machtelt Garrels Garrels BVBA Version 1.11 Last updated 20081227 Edition Bash Guide for Beginners Table of Contents Introduction.........................................................................................................................................................1 1. Why this guide?...................................................................................................................................1 2. Who should read this book? .................................................................................................................1 3. New versions, translations and availability.........................................................................................2 4. Revision History..................................................................................................................................2 5. Contributions.......................................................................................................................................3 6. Feedback..............................................................................................................................................3 7. Copyright information.........................................................................................................................3 8. What do you need? .......................................................................................................................

Words: 29161 - Pages: 117

Free Essay

Mussel Shells as Bricks

...The Effectiveness of Using Mussel Shells as an Alternative Ingredient in Making Bricks Chapter I ABSTRACT Waste management has been a problem since then because lots of wastes are not used efficiently- needing the people to make a move to convert these wastes into useful things. Thus, this study is undertaken to contribute to the ideas of waste management programs and to find out the effectiveness of mussel shells as an alternative material in making bricks. This study intends to make eco-friendly and affordable bricks by combining the powdered mussel shells, sand and cement with an appropriate ratios. A series of experiments were conducted to study the effect of using mussel shells on the compressive strength and percentage of water absorption of the bricks. The bricks were tested at the construction materials testing center and it proved that the bricks can hold enough strength and can absorb much water. It showed that the sample 1 (3tahong:1cement) has a compressive strength of 3.75MPa which means it is considered as a non structural brick and it has a percentage of water absorption of 13.02%. Since using mussel shell as a component in making bricks will only produce a non structural brick, the researchers conducted another set of samples. Sample 2 can carry more loads 325kN than the two other samples 3 and 4, 275kN and 115kN but sample 2 can absorb more water 19.26% than the other two, 15.7%. Chapter II Introduction Background of the Study ...

Words: 3024 - Pages: 13

Free Essay

Linux Cli Paper

...bash- is a Unix shell written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. Released in 1989, it has been distributed widely as the shell for the GNU operating system and as the default shell on Linux, Mac OS X and Darwin. 2) bsh- (Bourne shell) was the default Unix shell of Unix Version 7. Developed by Stephen Bourne at AT&T Bell Laboratories, it was a replacement for the Thompson shell. It was released in 1977 in the Version 7 Unix release distributed to colleges and universities. 3) tcsh- is a Unix shell based on and compatible with the C shell (csh). It is essentially the C shell with programmable command line completion, command-line editing, and a few other features. 4) csh- is a Unix shell that was created by Bill Joy while a graduate student at University of California, Berkeley in the 1970s. Other early contributors to the ideas or the code were Michael Ubell, Eric Allman, Mike O'Brien and Jim Kulp. The C shell is a command processor typically run in a text window, allowing the user to type commands. The C shell can also read commands from a file, called a script. 5) ksh- is a Unix shell which was developed by David Korn at Bell Labs in the early. Other early contributors were Bell Labs developers Mike Veach and Pat Sullivan, who wrote the Emacs- and vi-style line editing modes′ code, respectively. KornShell is backward-compatible with the Bourne shell and includes many features of the C shell, inspired by...

Words: 1015 - Pages: 5

Free Essay

Nothing

...Synopsis On The Topic:- Shell for LINUX (Details of specifications & services of different old & new shell interfaces of Linux) Submitted to: - Submitted by:- Mr. Akash Bharadwaj Deepak Gautam 11010183 K2R21- A 08 MCA-M.tech (cse) What is shell an introduction? The shell sits between you and the operating system, acting as a command interpreter. It reads your terminal input and translates the commands into actions taken by the system. The shell is analogous to command.com in DOS. When you log into the system you are given a default shell. When the shell starts up it reads its startup files and may set environment variables, command search paths, and command aliases, and executes any commands specified in these files. The original shell was the Bourne shell, sh. Every UNIX platform will either have the Bourne shell, or a Bourne compatible shell available. The default prompt for the Bourne shell is $ (or #, for the root user). Another popular shell is C Shell. The default prompt for the C shell is %. Shell script Normally shells are interactive. It means shell accept command from you (via keyboard) and execute them. But if you use command one by one (sequence of 'n' number of commands) , the you can store this sequence of command to text file and tell the shell to execute this text...

Words: 581 - Pages: 3

Free Essay

Mastering Unix Shell Scripting

...Mastering Unix Shell Scripting Randal K. Michael Free & Share & Open The Dear Valued Customer, WILEY advantage We realize you’re a busy professional with deadlines to hit. Whether your goal is to learn a new technology or solve a critical problem, we want to be there to lend you a hand. Our primary objective is to provide you with the insight and knowledge you need to stay atop the highly competitive and everchanging technology industry. Wiley Publishing, Inc., offers books on a wide variety of technical categories, including security, data warehousing, software development tools, and networking — everything you need to reach your peak. Regardless of your level of expertise, the Wiley family of books has you covered. • For Dummies – The fun and easy way to learn • The Weekend Crash Course –The fastest way to learn a new tool or technology • Visual – For those who prefer to learn a new topic visually • The Bible – The 100% comprehensive tutorial and reference • The Wiley Professional list – Practical and reliable resources for IT professionals The book you hold now, Mastering Unix Shell Scripting, is the first book to provide end-to-end scripting solutions that will solve real-world system administration problems for those who have to automate these often complex and repetitive tasks. Starting with a sample task and targeting the most common Unix systems: Solaris, Linux, AIX, and HP-UX with specific command structures, this book will save precious time with hands-on...

Words: 145371 - Pages: 582

Premium Essay

Chapter 6 Review Questions

...1. Your organization routinely uses scripts, but as some employees have left, there are scripts that contain only command lines and no one is certain of their purpose. What steps can be taken to ensure a way for others to know the purpose of a script? C. Require that script writers place comment lines inside the scripts using the # symbol to begin each command line. 2. Which of the following shells enable the use of scripts? (Choose all that apply.) A. Bash B. csh D. zsh 3. You frequently use the command ls-a and want to save time by just entering l to do the same thing. Which of the following commands enables you to set your system to view hidden files by only entering l? D. alias l= "ls -a" 4. You have written a script, but when you run it there is an error. Which of the following commands can you use to debug your script? (Choose all that apply.) B. sh -v D. sh –x 5. You have written a shell program that creates four temporary files. Which of the following commands can you use to remove these files when the script has completed its work? A. trap 6. Which of the following commands work well for menus used in a script? (Choose all that apply.) B. case 7. You are currently in the soruce directory, which is the new directory you have just created for storying and running your scripts. You want to make certain that the source directory is in your default path. Which of the following commands enable you to view the current...

Words: 356 - Pages: 2

Premium Essay

Bash Shell

...is a Unix shell written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell (sh). Released in 1989, it has been distributed widely as the shell for the GNU operating system and as the default shell on Linux and Mac OS X. It has been ported to Microsoft Windows and distributed with Cygwin and MinGW, to DOS by the DJGPP project, to Novell NetWare and to Android via various terminal emulation applications. Bash is a command processor, typically run in a text window, allowing the user to type commands which cause actions. Bash can also read commands from a file, called a script. Like all Unix shells, it supports filename wildcarding, piping, here documents, command substitution, variables and control structures for condition-testing and iteration. The keywords, syntax and other basic features of the language were all copied from sh. Other features, e.g., history, were copied from csh and ksh. Bash is a POSIX shell but with a number of extensions. The name itself is an acronym, a pun, and a description. As an acronym, it stands for Bourne-again shell, referring to its objective as a free replacement for the Bourne shell. As a pun, it expressed that objective in a phrase that sounds similar to born again, a term for spiritual rebirth.The name is also descriptive of what it did, bashing together the features of sh, csh and ksh. The Bash command syntax is a superset of the Bourne shell command syntax. The vast majority of Bourne shell scripts can...

Words: 419 - Pages: 2

Free Essay

Analysis of the Sentry by Wilfred Owen

...experience and its translation into words suggesting an experience of great intensity. The setting is an old Boche dug-out’ which a party of English troops has taken, but not without being seen: consequently, it comes under enemy fire, ‘shell on frantic shell’ pounding its position. The co-opted dug-out is a ‘hell’ on earth, not only because of the artillery bombardment, but also because of the bad weather. It is raining heavily: into the dug-out pour ‘waterfalls of slime’ with the result that the men stand in ‘slush waist-high’ and cannot climb out. The first line “We'd found an old Boche dug-out, and he knew,” owen uses “he” as a derogatory term for all the soldiers of the opposition. This line is also an enjambment as the first line and its thought continues to the next line. The second and third line describe the “shells” or bombs “And gave us hell, for shell on frantic shell Hammered on top, but never quite burst through” – here owen describes how the shells never penetrated into the place they were, but the shells were close. He also uses a figure of speech, namely personification, to describe the shells as frantic. The words “hell” and shell” in the second line have an internal rhyming. And the repition of the word shell tells the readers that the bombing was one after the other. The next to lines tells the readers how the bad weather adds on to the soldiers misery, how even nature was not on their side now. “waterfall made of slime” is an oxymoron because...

Words: 968 - Pages: 4

Free Essay

Gastropod Mobility on Rocky Shores

...containing one or two shells with a few exceptions. They are soft-bodied bilaterally symmetrical animals with organs present in a fluid-filled cavity hence soft bodied referring to word mollusc (latin). Classification of the Molluscs has major turmoil of instability in the Animal Kingdom. Since, most of the resources and text books use old system of classification, and that is stable, easy to recognize, and complies with Cambridge Zoology Museum, so we are adapting that very system for their identification. Habitat of Molluscs Molluscs occupy mostly marine and moist environments that are why some of them have rudiments of amphibians they kept along during the evolutionary attempts. Some of the gastropods however, dwell in the freshwater also. Others occupy the bottoms of lakes depending on their feeding habits. Some of the molluscs reach the terrestrial environments e.g. snails and slugs. Habitat of the shells typically affect their adaptive structural formation and hence identification. The lines of the shells are dependent upon the tidal emersions. Also, the internal tidal indications of the structure indicate micro-growth line formation in molluscs from sub-tidal areas (Mirzaei et al., 2014). Classfication of the molluscs has classicaly been associated with the structure of the radula or structure of the shell. Within the phylum Mollusca, there are seven classes (Barnes et al., 1993); viz Aplacophora – solenogastrids and caudofoveates (without shells); Cephalopoda – octopi...

Words: 3266 - Pages: 14

Free Essay

Rhoms

...blue or original aim-circles available through in-game settings - Visibility of aim-circles optimized - Crosshair colors optimized - Version of Artillery crosshair with shell travel time removed - XVM v3.5.0 included with config matching crosshair colors - Artillery and Tank Destroyer angle indicators moved to minimap (XVM) - Clock top left moved to config (XVM) - J1mB0’s logo added as player icon (XVM) 1.22 - World of Tanks v0.8.4 supported - Angle indicator added for Tank Destroyers 1.21 - World of Tanks v0.8.3 supported 1.20 - DebugPanel.swf reintroduced with clock - Font in FragCorrelation.swf fixed 1.19 - World of Tanks v0.8.2 supported - Clock removed - Angle indicator moved to FragCorrelation.swf 1.18 - World of Tanks v0.8.1 supported - Angle indicator for Artillery added - Clock added to DebugPanel 1.17 - World of Tanks v0.8.0 supported - Artillery aiming optimized - Angle indicator for Artillery removed 1.16 - World of Tanks v0.7.5 supported - My logo used as lag indicator - Center marker for Artillery angle indicator added - All sec changed to s 1.15 - World of Tanks v0.7.4 supported - Server side crosshairs removed - Performance optimized - Cassette indicators optimized - Angle indicator for Artillery added 1.14 - World of Tanks v0.7.3 supported - Distance indicators fixed - Design tweaked - Shell travel time added to crosshair_panel_strategic.swf - Max reload...

Words: 549 - Pages: 3

Premium Essay

Bash Qs Ref

...9 9 Chapter9 Answers to Evennumbered Exercises 9 1. 2. What are two ways you can execute a shell script when you do not have execute access permission to the file containing the script? Can you execute a shell script if you do not have read access permission? You can give the name of the file containing the script as an argument to the shell (for example, sh scriptfile, where scriptfile is the name of the file containing the script). Under bash you can give the following command: $ . scriptfile Because the shell must read the commands from the file containing a shell script before it can execute the commands, you must have read permission for the file in order to execute the shell script. 3. 4. Assume that you have made the following assignment: $ person=jenny Give the output of each of the following commands: a. echo $person jenny b. echo '$person' $person c. echo "$person" jenny 5. 1 2 Chapter 9 6. Assume that the /home/jenny/grants/biblios and /home/jenny/biblios directories exist. For both (a) and (b), give Jenny’s working directory after she executes the sequence of commands given. Explain. a. $ pwd /home/jenny/grants $ CDPATH=$(pwd) $ cd $ cd biblios After executing the preceding commands, Jenny’s working directory is /home/jenny/grants/biblios. When CDPATH is set, cd searches only the directories specified by CDPATH; cd does not search the working directory unless the working directory is specified in CDPATH (by using a period). b. $ pwd /home/jenny/grants $...

Words: 737 - Pages: 3

Premium Essay

Nt1210 Intro to Networking Lab 5.4

...go to start menu then accessories CMD. From CMD we would type Ping –a 192.168.1.5 to retrieve the information we need. Exercise 5.4.2 What is the best (easiest and most efficient) command to determine whether all the hosts on the local-area network are reachable? You can assume that you are starting from computer A. List the command sequence(s) you would need to enter to test this functionality. Windows+R will bring up run command type CMD or go to start menu then accessories CMD. From CMD we would type Ping 192.168.1.5, Ping 192.168.1.4, and Ping 192.168.1.3, Ping 192.168.1.6, and Ping 192.168.1.2. This would be a quick easier way but for a more complex way type FOR /L %i IN (1,1,254) DO ping -n 1 192.168.1.%i | FIND /i "Reply">>c:\ipaddresses.txt in CMD. exercise 5.4.3 Exercise 5.4.3 If your computer (node A) is unable to reach the Internet, what is the best way to determine where the error is occurring using command-line networking? Give the command sequence you would use to determine this. Ping 192.168.1.4 Exercise 5.4.4 If your local machine (node A) is not connecting to any other hosts on the network, what two commands will give you information on whether your network device is active and the current configuration of your NIC or adapter? Type Netstat into CMD and...

Words: 344 - Pages: 2

Free Essay

Pt1420 Unit 6 Assignment 1

...Week 06 Assignments Textbook Reading * Chapter 4 * Chapter 5 sections 5.1, 5.2, and 5.3 (pages 196-201) Week 06 Homework From the Gaddis textbook: * Programming Exercises 2, 6 and 9, on pages 160-161 For the Programming Exercises, design a program means write the pseudocode for the program. Except for Programming Exercise 2, your design should include multiple modules, not just main(). Upload a Microsoft Word document with the pseudocode to your shared PT1420 community website or submit a paper copy to your instructor by the beginning of the Week 7 class. Programing Exercises pg. 160-161 2. Areas of rectangles Module Main() Declare width1 integer = 0 Declare length1 integer = 0 Declare width2 integer = 0 Declare length2 integer = 0 Declare area1 integer = 0 Declare area2 integer = 0 Call rectangle1 (width1, length1, area1) Call rectangle2 (width2, length2, area2) Call comparison (rectangle1, rectangle2) Display “press enter to continue” End module Module rectangle1 (value width1 as integer, value length1 as integer, value area1 as integer) Display "Enter the width of rectangle 1” Input width1 Display "Enter the length of rectangle 1" Input length1 area1 = width1 * length1 End module Module rectangle2 (value width2 as integer, value length2 as integer, value area2 as integer) Display "Enter the width of rectangle 2” Input width2 Display "Enter the length of rectangle 2" Input length2 area2 = width2 * length2 End module ...

Words: 764 - Pages: 4

Premium Essay

Ccccccc

...BASH SHELL Bash is a Unix shell written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell .Released in 1989, it has been distributed widely as the shell for the GNU operating system and as a default shell on Linux and Mac OS X. It has been ported to Microsoft Windows and distributed with Cygwin and MinGW, to DOS by the DJGPP project, to Novell NetWare and to Android via various terminal emulation applications. Bash is a command processor, typically run in a text window, allowing the user to type commands which cause actions. Bash can also read commands from a file, called a script. Like all Unix shells, it supports filename wildcarding, piping, here documents, command substitution, variables and control structures for condition testing and iteration. The keywords, syntax and other basic features of the language were all copied from sh. Other features, e.g., history, were copied from csh and ksh. Bash is a POSIX shell but with a number of extensions. The name itself is an acronym, a pun, and a description. As an acronym, it stands for Bourne-again shell, referring to its objective as a free replacement for the Bourne shell. As a pun, it expressed that objective in a phrase that sounds similar to born again, a term for spiritual rebirth. The name is also descriptive of what it did, bashing together the features of sh, csh, and ksh. Early computers had a teletype machine with a keyboard for I/O. Later, glass terminals became the norm,...

Words: 369 - Pages: 2

Premium Essay

Mr. Ola

...As you have probably discovered by this point, sometimes a shell script does not execute because there is an error in one or more commands within the script. For example, perhaps you entered a colon instead of a semicolon or left out a bracket. Another common problem is leaving out a space or not putting a space in the correct location. Now that you have some experience developing shell scripts and have possibly encountered some problems, you can appreciate why it is important to have a tool to help you troubleshoot errors. The sh command that is used to run a shell script includes several options for debugging. Syntax sh [-options] [shell script] Dissection ■ In UNIX and Linux, it calls the command interpreter for shell scripts;and in Linux, it uses the Bash shell with the command interpreter ■ Useful options include: -n checks the syntax of a shell script, but does not execute command lines -v displays the lines of code while executing a shell script -x displays the command and arguments as a shell script is run Two of the most commonly used sh options are -v and -x. The -v option displays the lines of code in the script as they are read by the interpreter. The -x option shows somewhat different information by displaying the command and accompanying arguments line by line as they are run. By using the sh command with these options, you can view the shell script line by line as it is running and determine the location and nature of an error on a line when...

Words: 315 - Pages: 2