Premium Essay

Bash Qs Ref

In:

Submitted By Goldensloth
Words 737
Pages 3
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
$ CDPATH=$(pwd)
$ cd $HOME/biblios

After executing the preceding commands, Jenny’s working directory is
/home/jenny/biblios because, when you give cd an absolute pathname as an argument, cd does not use CDPATH.
7.

8. Give the following command:
$ sleep 30 | cat /etc/inittab

Is there any output from sleep? Where does cat get its input from? What has to happen before you get a prompt back?
There

Similar Documents

Premium Essay

Redhat

...Minds, Inc. Best-Selling Books G Digital Downloads G e-Books G Answer Networks e-Newsletters G Branded Web Sites G e-Learning New York, NY G Cleveland, OH G Indianapolis, IN Red Hat® Linux® Networking and System Administration Published by Hungry Minds, Inc. 909 Third Avenue New York, NY 10022 www.hungryminds.com Copyright © 2002 Hungry Minds, Inc. All rights reserved. No part of this book, including interior design, cover design, and icons, may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording, or otherwise) without the prior written permission of the publisher. Library of Congress Control Number: 2001093591 ISBN: 0-7645-3632-X Printed in the United States of America 10 9 8 7 6 5 4 3 2 1 1O/RT/QT/QS/IN Distributed in the United States by Hungry Minds, Inc. Distributed by CDG Books Canada Inc. for Canada; by Transworld Publishers Limited in the United Kingdom; by IDG Norge Books for Norway; by IDG Sweden Books for Sweden; by IDG Books Australia Publishing Corporation Pty. Ltd. for Australia and New Zealand; by TransQuest Publishers Pte Ltd. for Singapore, Malaysia, Thailand, Indonesia, and Hong Kong; by Gotop Information Inc. for Taiwan; by ICG Muse, Inc. for Japan; by Intersoft for South Africa; by Eyrolles for France; by International Thomson Publishing for Germany, Austria, and Switzerland; by Distribuidora Cuspide for Argentina; by LR International for Brazil; by Galileo Libros for Chile; by Ediciones ZETA S.C.R. Ltda. for Peru; by...

Words: 220815 - Pages: 884

Free Essay

What Is Powershell

...©Manning Publications Co. Please post comments or corrections to the Author Online forum: http://www.manning-sandbox.com/forum.jspa?forumID=542 1 MEAP Edition Manning Early Access Program Copyright © 2010 Manning Publications For more information on this and other Manning titles go to www.manning.com ©Manning Publications Co. Please post comments or corrections to the Author Online forum: http://www.manning-sandbox.com/forum.jspa?forumID=542 Licensed to Andrew M. Tearle 2 Table of Contents Part 1 LEARNING POWERSHELL 1 1 Welcome to PowerShell 2 Foundations of PowerShell 3 Working with types 4 Operators and expressions 5 Advanced operators and variables 6 Flow control in scripts 7 PowerShell Functions 8 Advanced functions and scripts 9 Using and Authoring Modules 10 Module Manifests and Metadata 11 Metaprogramming with ScriptBlocks and Dynamic Code 12 Remoting and Background Jobs 13 Remoting: Configuring Applications and Services 14 Errors and exceptions 15 The PowerShell ISE and Debugger Part 2 USING POWERSHELL 16 Working with paths , text, and XML 17 Getting fancy—.NET and WinForms 18 Windows objects: COM, WMI and WSMan 19 Security, security, security appendix A Comparing PowerShell to other languages appendix B Admin examples appendix C The PowerShell grammar appendix D Additional PowerShell Topic ©Manning Publications Co. Please post comments or corrections to the Author Online forum: http://www.manning-sandbox.com/forum.jspa?forumID=542 ...

Words: 186534 - Pages: 747

Free Essay

Gd-Pi

...Hundreds(of(real(personal(accounts(of Group'Discussions'&'Personal'Interviews during(MBA(admissions(to(India’s(best(B9schools Written'by Compiled'by Loads'of'MBA'Aspirants The'PaGaLGuY'MadCapz'Group PaGaLGuY.com Antholo gy Hundreds of real personal accounts of Group Discussions and Personal Interviews during MBA admissions to India’s best business schools. In this edition: The IIMs at Ahmedabad, Bangalore, Calcutta, Lucknow, Indore & Kozhikode. Written by Loads of MBA aspirants Compiled by The PaGaLGuY MadCapz Team PaGaLGuY GD-PI Anthology Copyright © 2011, PaGaLGuY.com All text and content in this document is solely owned by PaGaLGuY.com. Reproduction without permission in any form or means is illegal. Special copy prepared exclusively for mustafa rokerya Get your own Free personalized copy (with your name on it) of this book from http://www.pagalguy.com/books/ What this book is about What is a real IIM interview like? What kind of questions do they ask and what judgments do applicants have to make while answering them? Since 2003, those with real Group Discussion and Personal Interview calls from India’s top bschools have been posting entire and detailed transcripts of their admission interviews immediately after they happen, so that others slotted for later interviews can learn what GDPI is going to be like this year. This book is a collection of dozens of handpicked GDPI experiences from the country’s top bschools during the admission...

Words: 178933 - Pages: 716

Free Essay

Maglev

...*3963103* [3963] – 103 T.E. (Petroleum) (Semester – I) Examination, 2011 DRILLING & PRODUCTION OPERATIONS (2003 Course) Time : 3 Hours Max. Marks : 100 Instructions : 1) Question Nos. 1 and 5 are compulsory. Out of the remaining attempt 2 questions from Section I and 2 questions from Section II. 2) Answers to the two Sections should be written in separate books. 3) Neat diagrams must be drawn wherever necessary. 4) Black figures to the right indicate full marks. 5) Use of Logarithmic Tables, Slide Rule, Mollier Charts, Electronic Pocket Calculator and Steam Tables is allowed. 6) Assume suitable data, if necessary. SECTION – I 1. What are different systems on a drilling rig ? Explain any one in detail with suitable diagramme. 18 2. a) Calculate Bottom hole pressure if well depth is 2500 m and mud weight is 1.2 gm/cc. b) Calculate mud weight if mud gradient is 0.87 psi/ft. ′ c) Calculate volume bbl/meter for drill pipe O.D. = 5′ inch and I.D. = 4.276 inch. 2 2 2 10 8 8 16 d) Draw circulation system on a drilling rig. 3. a) Discuss IADC classification of a bit in details. b) Discuss different factors affecting rate of penetration in details. 4. Write short note on : i) Coring ii) Fishing tools iii) BOP iv) Directional well P.T.O. [3963] – 103 -2- *3963103* SECTION – II 5. a) Discuss different types of casings and function of the casings in brief. b) Discuss different types of well completion techniques. 6. a) Discuss primary cementation process with...

Words: 172166 - Pages: 689