- Page 1 and 2: Sams Teach Yourself Shell Programmi
- Page 3 and 4: ● Using Single Quotes ● Using D
- Page 5 and 6: ● Questions Hour 20: Debugging
- Page 7 and 8: Sams Teach Yourself Shell Programmi
- Page 9 and 10: ● Part I is an introduction to UN
- Page 11 and 12: Many of the examples and the answer
- Page 13 and 14: Sams Teach Yourself Shell Programmi
- Page 15 and 16: Sams Teach Yourself Shell Programmi
- Page 17 and 18: $ date [ENTER] Wed Dec 9 08:49:13 P
- Page 19 and 20: anga pts/0 Dec 9 08:49 $ Here, the
- Page 21 and 22: Sams Teach Yourself Shell Programmi
- Page 23 and 24: The original UNIX shell was written
- Page 25 and 26: There are three major versions of k
- Page 27 and 28: Sams Teach Yourself Shell Programmi
- Page 29 and 30: Sams Teach Yourself Shell Programmi
- Page 31 and 32: example, when you execute the comma
- Page 33 and 34: Sams Teach Yourself Shell Programmi
- Page 35 and 36: This executes the compound command
- Page 37 and 38: chmod a+x ./logins Here you are usi
- Page 39: Sams Teach Yourself Shell Programmi
- Page 43 and 44: Sams Teach Yourself Shell Programmi
- Page 45 and 46: Sams Teach Yourself Shell Programmi
- Page 47 and 48: Sams Teach Yourself Shell Programmi
- Page 49 and 50: Hidden Files So far you have used l
- Page 51 and 52: © Copyright Macmillan Computer Pub
- Page 53 and 54: Numbering Lines The cat command als
- Page 55 and 56: command $ wc -w .rhosts produces th
- Page 57 and 58: Sams Teach Yourself Shell Programmi
- Page 59 and 60: produces the following error: cp: w
- Page 61 and 62: m: work directory The two files are
- Page 63 and 64: Sams Teach Yourself Shell Programmi
- Page 65 and 66: Sams Teach Yourself Shell Programmi
- Page 67 and 68: name. Thus both of the following fi
- Page 69 and 70: ../docs/ch5.doc represents the file
- Page 71 and 72: changes to the directory /usr/local
- Page 73 and 74: Sams Teach Yourself Shell Programmi
- Page 75 and 76: If you specify several arguments in
- Page 77 and 78: Sometimes when you want to create a
- Page 79 and 80: $ cp -r docs /mnt/zip/backup cp: ca
- Page 81 and 82: Removing Directories You can use tw
- Page 83 and 84: Sams Teach Yourself Shell Programmi
- Page 85 and 86: Sams Teach Yourself Shell Programmi
- Page 87 and 88: $ ls -ld /home/ranga This produces
- Page 89 and 90: You can see the relative path by us
- Page 91 and 92:
Sections in this Chapter: File Type
- Page 93 and 94:
The permission block for this file
- Page 95 and 96:
Here, expression is a statement of
- Page 97 and 98:
For example, if the directory pub c
- Page 99 and 100:
Restrictions The super user, root,
- Page 101 and 102:
Sams Teach Yourself Shell Programmi
- Page 103 and 104:
Sams Teach Yourself Shell Programmi
- Page 105 and 106:
Running the same ls command as in t
- Page 107 and 108:
Tip - Background Processes That Wri
- Page 109 and 110:
the fg command. By default, the pro
- Page 111 and 112:
Sams Teach Yourself Shell Programmi
- Page 113 and 114:
dhorvath 6770 3662 2 10:35:45 pts/6
- Page 115 and 116:
Sams Teach Yourself Shell Programmi
- Page 117 and 118:
Sams Teach Yourself Shell Programmi
- Page 119 and 120:
By default, a process runs with the
- Page 121 and 122:
Sams Teach Yourself Shell Programmi
- Page 123 and 124:
Process Identifier --The process id
- Page 125 and 126:
Variable Names The name of a variab
- Page 127 and 128:
Array Variables The Bourne shell, s
- Page 129 and 130:
$ band[2]=mike $ band[3]=gene Tip -
- Page 131 and 132:
Hour 7: Variables Sections in this
- Page 133 and 134:
Sams Teach Yourself Shell Programmi
- Page 135 and 136:
uses internally. Users can modify t
- Page 137 and 138:
Sams Teach Yourself Shell Programmi
- Page 139 and 140:
Sams Teach Yourself Shell Programmi
- Page 141 and 142:
Here, command is the name of a comm
- Page 143 and 144:
$ ls ch??.doc to accomplish this. M
- Page 145 and 146:
© Copyright Macmillan Computer Pub
- Page 147 and 148:
is unset. Assigning a Default Value
- Page 149 and 150:
Sams Teach Yourself Shell Programmi
- Page 151 and 152:
© Copyright Macmillan Computer Pub
- Page 153 and 154:
Sams Teach Yourself Shell Programmi
- Page 155 and 156:
It now gives this error result: Hel
- Page 157 and 158:
Sams Teach Yourself Shell Programmi
- Page 159 and 160:
Sams Teach Yourself Shell Programmi
- Page 161 and 162:
Sections in this Chapter: Quoting w
- Page 163 and 164:
To the shell, one or more spaces or
- Page 165 and 166:
Quoting Regular Expression Wildcard
- Page 167 and 168:
Sams Teach Yourself Shell Programmi
- Page 169 and 170:
Sams Teach Yourself Shell Programmi
- Page 171 and 172:
fi list5 Both the elif and the else
- Page 173 and 174:
Here you have an elif statement tha
- Page 175 and 176:
Consider the following if statement
- Page 177 and 178:
If you were to use the - n option i
- Page 179 and 180:
else echo "An error was encountered
- Page 181 and 182:
1. First the test [ -z "$DTHOME" ]
- Page 183 and 184:
Sams Teach Yourself Shell Programmi
- Page 185 and 186:
esac Here the string contained in $
- Page 187 and 188:
Sams Teach Yourself Shell Programmi
- Page 189 and 190:
The execution of a while loop proce
- Page 191 and 192:
5 4 3 2 1 0 6 5 4 3 2 1 0 7 6 5 4 3
- Page 193 and 194:
2. If the exit status of command is
- Page 195 and 196:
for i in 0 1 2 3 4 5 6 7 8 9 do ech
- Page 197 and 198:
3. When the user enters a value, $R
- Page 199 and 200:
Sams Teach Yourself Shell Programmi
- Page 201 and 202:
The continue Command The continue c
- Page 203 and 204:
Sams Teach Yourself Shell Programmi
- Page 205 and 206:
Sams Teach Yourself Shell Programmi
- Page 207 and 208:
If you want to list the contents of
- Page 209 and 210:
Sams Teach Yourself Shell Programmi
- Page 211 and 212:
In this version, the basename comma
- Page 213 and 214:
USAGE="Usage: ´basename $0´ [-c|-
- Page 215 and 216:
uuencoding a file. For readers who
- Page 217 and 218:
fi fi echo $MSG You could simplify
- Page 219 and 220:
Sams Teach Yourself Shell Programmi
- Page 221 and 222:
Sams Teach Yourself Shell Programmi
- Page 223 and 224:
● Formatting escape sequences Emb
- Page 225 and 226:
Name User Name Sriranga ranga Sriva
- Page 227 and 228:
Table 13.2 Formatting Sequence Type
- Page 229 and 230:
printf "%-32s " "$i" if [ -d "$i" ]
- Page 231 and 232:
anga ttyp0 Oct 27 19:42 (:0.0) amma
- Page 233 and 234:
Say you need to send a list of phon
- Page 235 and 236:
"Miscellaneous Tools," I will show
- Page 237 and 238:
$ exec 4>fd4.out associates the fil
- Page 239 and 240:
command > file 2>&1 list > file 2>&
- Page 241 and 242:
when the while loop exits, the valu
- Page 243 and 244:
Sams Teach Yourself Shell Programmi
- Page 245 and 246:
Sams Teach Yourself Shell Programmi
- Page 247 and 248:
Note - The shell uses the value of
- Page 249 and 250:
This function has three important p
- Page 251 and 252:
} OLDIFS="$IFS" IFS=: # print each
- Page 253 and 254:
} # set the directory to pop to the
- Page 255 and 256:
Sams Teach Yourself Shell Programmi
- Page 257 and 258:
Sams Teach Yourself Shell Programmi
- Page 259 and 260:
index.html RCS humor misc downloads
- Page 261 and 262:
Sams Teach Yourself Shell Programmi
- Page 263 and 264:
unix has several additional pieces
- Page 265 and 266:
pqops.c:/* Function to delete a nod
- Page 267 and 268:
Here I specified set2 as the space
- Page 269 and 270:
$ tr '!?":;\[\]{}(),.\t\n' ' ' < /h
- Page 271 and 272:
in 69 ' 65 the 389 to 164 of 127 No
- Page 273 and 274:
tr '[:classname:]' 'set2' Here clas
- Page 275 and 276:
Sams Teach Yourself Shell Programmi
- Page 277 and 278:
Sams Teach Yourself Shell Programmi
- Page 279 and 280:
single letters, whereas in awk the
- Page 281 and 282:
able was I, ere I saw elba Because
- Page 283 and 284:
By adding the ^ metacharacter as fo
- Page 285 and 286:
\$[0-9]*\.[0-9][0-9]\/[a-zA-Z]*/ If
- Page 287 and 288:
Here you list the name of a fruit a
- Page 289 and 290:
$ rm fruit_prices.txt.$$ Performing
- Page 291 and 292:
Fortunately, the s command provides
- Page 293 and 294:
Sams Teach Yourself Shell Programmi
- Page 295 and 296:
lrwxrwxrwx 1 ranga users 8 Nov 27 1
- Page 297 and 298:
The original awk has remained almos
- Page 299 and 300:
Kiwi 22 Pineapple 35 Apple 78 All t
- Page 301 and 302:
Pineapple $1.29 35 REORDER Apple $0
- Page 303 and 304:
$ ls -l produces output formatted s
- Page 305 and 306:
The value that you assign a variabl
- Page 307 and 308:
x=x+1 In awk this can be written in
- Page 309 and 310:
the pattern specifies. To solve you
- Page 311 and 312:
awk -F: '{ ... }' The major differe
- Page 313 and 314:
identical to expressions you looked
- Page 315 and 316:
The basic syntax is do { actions }
- Page 317 and 318:
Sams Teach Yourself Shell Programmi
- Page 319 and 320:
B:amount Here amount is the balance
- Page 321 and 322:
Sams Teach Yourself Shell Programmi
- Page 323 and 324:
The OUTPUT variable contains the >
- Page 325 and 326:
: ${LINES:=24} ${TERM:?"TERM not se
- Page 327 and 328:
Sections in this Chapter: The eval
- Page 329 and 330:
Sams Teach Yourself Shell Programmi
- Page 331 and 332:
eports/1998 The starting directory.
- Page 333 and 334:
find: -type Option The -type option
- Page 335 and 336:
find / -name alpha -size +50 -mtime
- Page 337 and 338:
Sams Teach Yourself Shell Programmi
- Page 339 and 340:
Sams Teach Yourself Shell Programmi
- Page 341 and 342:
Sams Teach Yourself Shell Programmi
- Page 343 and 344:
18 quit $ obase=16 sets the output
- Page 345 and 346:
Sams Teach Yourself Shell Programmi
- Page 347 and 348:
Sams Teach Yourself Shell Programmi
- Page 349 and 350:
Sams Teach Yourself Shell Programmi
- Page 351 and 352:
The default action for the signals
- Page 353 and 354:
Sams Teach Yourself Shell Programmi
- Page 355 and 356:
fi Init() { printf "INFO: Initializ
- Page 357 and 358:
4. Wait for the program to finish e
- Page 359 and 360:
} if [ $? -eq 0 ] ; then echo "Sub-
- Page 361 and 362:
Sams Teach Yourself Shell Programmi
- Page 363 and 364:
A third way of enabling debugging i
- Page 365 and 366:
Here the debugging mode is enabled
- Page 367 and 368:
if [ $YN = "y" ] ; then Making this
- Page 369 and 370:
$ /bin/sh -nv ./buggy2.sh the outpu
- Page 371 and 372:
Sams Teach Yourself Shell Programmi
- Page 373 and 374:
Deleting old backups, please wait..
- Page 375 and 376:
If you do not type a response and p
- Page 377 and 378:
To deactivate debugging, use either
- Page 379 and 380:
Sams Teach Yourself Shell Programmi
- Page 381 and 382:
Sams Teach Yourself Shell Programmi
- Page 383 and 384:
3 MSG="hello" 4 echo_error $MSG Her
- Page 385 and 386:
Sams Teach Yourself Shell Programmi
- Page 387 and 388:
echo "ERROR: File $MYFILE was not f
- Page 389 and 390:
previous call to this function. Aft
- Page 391 and 392:
} Before you look at some examples
- Page 393 and 394:
dev/hda1 1190014 664661 463867 59%
- Page 395 and 396:
The number returned is in kilobytes
- Page 397 and 398:
getUID() { id $1 | sed -e 's/(.*$//
- Page 399 and 400:
63 printf "$1 (y/n)? " 64 65 if [ -
- Page 401 and 402:
}' 171 # Args: $1 -> the command na
- Page 403 and 404:
Sams Teach Yourself Shell Programmi
- Page 405 and 406:
Sams Teach Yourself Shell Programmi
- Page 407 and 408:
Some UNIX versions implement a work
- Page 409 and 410:
24 printERROR "The source $1 is not
- Page 411 and 412:
easily modify the script to replace
- Page 413 and 414:
Hour 22: Problem Solving with Shell
- Page 415 and 416:
To maintain your address book, you
- Page 417 and 418:
produces two matches: Name: Srirang
- Page 419 and 420:
26 # enable erasing input 27 28 stt
- Page 421 and 422:
2. Based on user feedback, delete t
- Page 423 and 424:
73 promptYESNO "Delete this entry"
- Page 425 and 426:
Sams Teach Yourself Shell Programmi
- Page 427 and 428:
MYADDRESSBOOK="$HOME/addressbook" i
- Page 429 and 430:
Sams Teach Yourself Shell Programmi
- Page 431 and 432:
Here, options is one or more of the
- Page 433 and 434:
Now that you have looked at using t
- Page 435 and 436:
Sams Teach Yourself Shell Programmi
- Page 437 and 438:
Abstraction is a technique used to
- Page 439 and 440:
warning: '-' deprecated; use 'ps au
- Page 441 and 442:
Sams Teach Yourself Shell Programmi
- Page 443 and 444:
Sams Teach Yourself Shell Programmi
- Page 445 and 446:
produce the same result if the curr
- Page 447 and 448:
Sams Teach Yourself Shell Programmi
- Page 449 and 450:
Sams Teach Yourself Shell Programmi
- Page 451 and 452:
The structure of the UNIX directory
- Page 453 and 454:
OLDPREFIX=aaa NEWPREFIX=bbb for FIL
- Page 455 and 456:
Sams Teach Yourself Shell Programmi
- Page 457 and 458:
history (Korn/Bash) shows the most
- Page 459 and 460:
Sams Teach Yourself Shell Programmi
- Page 461 and 462:
Sections in this Chapter: Reserved
- Page 463 and 464:
^ bitwise exclusive OR operation |
- Page 465 and 466:
Bash array initialization USERVAR=(
- Page 467 and 468:
Sams Teach Yourself Shell Programmi
- Page 469 and 470:
Sams Teach Yourself Shell Programmi
- Page 471 and 472:
Sams Teach Yourself Shell Programmi
- Page 473 and 474:
Sams Teach Yourself Shell Programmi
- Page 475 and 476:
Sams Teach Yourself Shell Programmi
- Page 477 and 478:
Sams Teach Yourself Shell Programmi
- Page 479 and 480:
Sams Teach Yourself Shell Programmi
- Page 481 and 482:
order to fix problems. default beha
- Page 483 and 484:
minor number UNIX uses this to asso
- Page 485 and 486:
important parameters. This is usual
- Page 487 and 488:
Sams Teach Yourself Shell Programmi
- Page 489 and 490:
Sams Teach Yourself Shell Programmi
- Page 491 and 492:
Sams Teach Yourself Shell Programmi
- Page 493 and 494:
Sams Teach Yourself Shell Programmi
- Page 495 and 496:
Sams Teach Yourself Shell Programmi
- Page 497 and 498:
Sams Teach Yourself Shell Programmi
- Page 499 and 500:
Sections in this Chapter: Chapter 1
- Page 501 and 502:
USAGE="Usage: ´basename $0´ [-v]
- Page 503 and 504:
Sams Teach Yourself Shell Programmi
- Page 505 and 506:
Sams Teach Yourself Shell Programmi
- Page 507 and 508:
Sams Teach Yourself Shell Programmi
- Page 509 and 510:
Sams Teach Yourself Shell Programmi
- Page 511 and 512:
Appendix C: Quiz Answers Sections i
- Page 513 and 514:
awk -F: ' $1 == "B" { BAL=$NF ; nex
- Page 515 and 516:
Sams Teach Yourself Shell Programmi
- Page 517 and 518:
} if [ $DEF_TOUT -ne 0 ] ; then sle
- Page 519 and 520:
Sections in this Chapter: Chapter 1
- Page 521 and 522:
} fi if [ ! -d "$1" ] ; then printE
- Page 523 and 524:
Sams Teach Yourself Shell Programmi
- Page 525 and 526:
Sams Teach Yourself Shell Programmi
- Page 527 and 528:
Sams Teach Yourself Shell Programmi
- Page 529 and 530:
numeric variables, 1st pattern-spec
- Page 531 and 532:
wildcards, 1st Bourne shells. See s
- Page 533 and 534:
(colon), 1st character, 1st, 2nd, 3
- Page 535 and 536:
grep, 1st, 2nd line numbers, 1st li
- Page 537 and 538:
stty addperson script, 1st tail, 1s
- Page 539 and 540:
Sams Teach Yourself Shell Programmi
- Page 541 and 542:
emoving temporary files, 1st displa
- Page 543 and 544:
mv command, 1st, 2nd rmdir command,
- Page 545 and 546:
interactive mode, 1st multiple inpu
- Page 547 and 548:
starting directory, 1st, 2nd findin
- Page 549 and 550:
Sams Teach Yourself Shell Programmi
- Page 551 and 552:
Sams Teach Yourself Shell Programmi
- Page 553 and 554:
installation scripts disk usage, 1s
- Page 555 and 556:
Sams Teach Yourself Shell Programmi
- Page 557 and 558:
eak command, 1st, 2nd, 3rd continue
- Page 559 and 560:
mvdir.sh, 1st, 2nd, 3rd, 4th, 5th,
- Page 561 and 562:
Sams Teach Yourself Shell Programmi
- Page 563 and 564:
edirection, 1st, 2nd appending to f
- Page 565 and 566:
[0-9]*, 1st percent sign (%) job nu
- Page 567 and 568:
profiles shell specific startup wit
- Page 569 and 570:
Sams Teach Yourself Shell Programmi
- Page 571 and 572:
Sams Teach Yourself Shell Programmi
- Page 573 and 574:
hardware type, 1st, 2nd improving,
- Page 575 and 576:
(standard error), 1st displaying me
- Page 577 and 578:
Sams Teach Yourself Shell Programmi
- Page 579 and 580:
Sams Teach Yourself Shell Programmi
- Page 581 and 582:
Sams Teach Yourself Shell Programmi
- Page 583 and 584:
Sams Teach Yourself Shell Programmi
- Page 585 and 586:
Sams Teach Yourself Shell Programmi
- Page 587 and 588:
Sams Teach Yourself Shell Programmi
- Page 589 and 590:
prompt, 1st, 2nd, 3rd, 4th quoting
- Page 591 and 592:
egp command, 1st -k option sort com
- Page 593:
Index A B C D E F G H I J K L M N O