Full Download Building Better PowerShell Code: Applying Proven Practices One Tip at A Time Adam Bertram PDF
Full Download Building Better PowerShell Code: Applying Proven Practices One Tip at A Time Adam Bertram PDF
com
https://textbookfull.com/product/building-better-
powershell-code-applying-proven-practices-one-tip-
at-a-time-adam-bertram/
https://textbookfull.com/product/fierce-conversations-achieving-
success-at-work-in-life-one-coversation-at-a-time-scott/
textbookfull.com
https://textbookfull.com/product/one-wild-bird-at-a-time-portraits-of-
individual-lives-heinrich/
textbookfull.com
https://textbookfull.com/product/going-horizontal-creating-a-non-
hierarchical-organization-one-practice-at-a-time-samantha-slade/
textbookfull.com
https://textbookfull.com/product/nanomechanics-of-graphene-and-design-
of-graphene-composites-xiaoyi-liu/
textbookfull.com
https://textbookfull.com/product/essential-clinical-anesthesia-review-
keywords-questions-and-answers-for-the-boards-1st-edition-linda-s-
aglio/
textbookfull.com
https://textbookfull.com/product/british-national-formulary-
bnf-68-68th-edition-pharmaceutical-press/
textbookfull.com
https://textbookfull.com/product/patterns-of-world-history-peter-von-
sivers/
textbookfull.com
https://textbookfull.com/product/best-practices-for-administering-
online-programs-1st-edition-daniel-hillman/
textbookfull.com
Data simplification taming information with open source
tools First Edition (Online-Ausg.) Berman
https://textbookfull.com/product/data-simplification-taming-
information-with-open-source-tools-first-edition-online-ausg-berman/
textbookfull.com
Building Better
PowerShell Code
Applying Proven Practices One Tip
at a Time
—
Adam Bertram
Building Better
PowerShell Code
Applying Proven Practices
One Tip at a Time
Adam Bertram
Building Better PowerShell Code: Applying Proven Practices One Tip
at a Time
Adam Bertram
Evansville, IN, USA
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
Index�������������������������������������������������������������������������������������������������143
ix
About the Author
Adam Bertram is a 22-year veteran of IT and
experienced online business professional.
He’s an entrepreneur, Microsoft MVP, blogger
at adamtheautomator.com, trainer, and writer
for multiple technology companies. Catch up
on Adam’s articles at adamtheautomator.com,
connect on linkedin.com/in/AdamBertram/,
or follow him on twitter.com/adbertram.
xi
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
About the Technical Reviewer
Vikas Sukhija has over 16 years of IT
infrastructure experience. He is certified/
worked on various Microsoft and related
technologies.
He has been awarded five times with
Microsoft Most Valuable Professional title
(thrice in Cloud and Datacenter management
(PowerShell) and twice in the Office 365
category).
With his experience on messaging and collaboration technologies, he
has assisted clients in migrating from one messaging platform to another.
He has utilized PowerShell for automation of various monotonous tasks
as well as created self-service solutions for users.
He has been recognized many times by clients for automations that
resulted in direct/indirect cost avoidance.
He is playing key roles with various large clients in the implementation
and adoption of Office 365.
He is the owner and author of the http://TechWizard.cloud,
http://SysCloudPro.comblog site.
He is also the owner and author of the https://www.facebook.com/
TechWizard.cloud Facebook page.
xiii
Acknowledgments
This book, along with all of my other career projects, could not have been
possible without my wife, Miranda. She’s the rock of our household and
has allowed me to pursue projects regardless of how crazy they have been
and has supported me for nearly 20 years now.
I also want to acknowledge all of those that have reached out and let
me know how much my work means to you. It may mean a lot to you,
but trust me, it means more to me to hear stories of how I’ve helped
throughout your career.
xv
Introduction
This book was created out of necessity. There are many books out there
on how to learn PowerShell. You’ll also find thousands of articles and blog
posts on PowerShell best practices. But there wasn’t an entire collection of
PowerShell learning and best practices brought together before.
Each chapter in this book is broken down by chapter with multiple
“tips” inside. Each chapter is a bucket for the kinds of tips you can expect
to read about. Each tip is a best practice. Tips are short, actionable steps
you can take today to help you improve your PowerShell scripts.
Tips do not go into major detail. There are other resources out there for
that. The tips in this book are not meant to be exhaustive how-tos but to
rather act as a checklist for actions to take. With each tip, you will typically
find an example to solidify your understanding of the tip.
All tips within this book should be treated as universal across all
PowerShell versions and platforms from Windows PowerShell 5.1 and later
including all PowerShell Core versions. If you see an example using code,
assume that it will work in your PowerShell version of choice. All examples
were written to be as generic as possible.
All tips in this book were written by me, but many were contributed
by the PowerShell community. If a tip did come from the community, the
community member will be referenced.
xvii
Introduction
This book is not meant to be “training,” per se. It’s not specifically
targeted at any level of PowerShell expertise. You will find tips in this book
ranging from the basic level all the way up to the advanced level. It’s up to
you to skip those tips that don’t apply to you and soak up the ones that do.
Read over this book periodically throughout your career. You’ll find
that each tip will vary based on specific contexts, use cases, and expertise
levels. Once you find yourself at that level, you’ll be able to understand and
get more out of those tips.
B
ook Resources
You will find all code referenced in this book in the (a) GitHub repository
called PowerShellTipsToWriteBy.
xviii
CHAPTER 1
Do the Basics
When it comes to code, there are a lot of opinions out there about
“best practices.” What one developer thinks is a must, another will refute
it. But these disagreements typically happen around specific, nuanced
situations like tabs vs. spaces and if a curly brace should go on a new line.
There are larger categories of tips and best practices that are universal.
Everyone can agree on broad tips like “write tests,” “make code reusable,”
and “don’t store passwords in clear text.”
In this chapter, we’re going to hit those broad strokes. We’re going to
cover the basic truths that almost everyone can agree on.
In the later chapters, we’ll dive deeper into each of these areas to
provide more specific tips the community and I have come up with.
Without further ado, let’s get to the tips!
F urther Learning
• How to Write a Pseudocode?
F urther Learning
• Get Started with the PowerShell Gallery
F urther Learning
• Building Advanced PowerShell Functions and Modules
2
Chapter 1 Do the Basics
F urther Learning
• Learn PowerShell Toolmaking in a Month of Lunches
F urther Learning
• Writing PowerShell Code for Performance
3
Chapter 1 Do the Basics
Build Pester unit tests to test your code. Build Pester integration/
acceptance/infrastructure tests to confirm the code you wrote changed
what you expected.
F urther Learning
• The Pester Book
F urther Learning
• The Big Book of PowerShell Error Handling
4
Chapter 1 Do the Basics
F urther Learning
• Clean Code: A Handbook of Agile Software
Craftsmanship
F urther Learning
• PowerShell Security at Enterprise Customers
5
Chapter 1 Do the Basics
F urther Learning
• Greater Visibility Through PowerShell Logging
P
arameterize Everything
This tip is related to the functions and tools tip. When building scripts and
functions, add as many parameters as necessary. Always add a parameter
that might one day hold a different value. Never add “static” values to your
scripts. If you need to define a value in code, create a parameter and assign
it a default value. Don’t assign that value in the code.
Creating parameters allows you to pass different values to your
functions or scripts at runtime instead of changing the code.
F urther Learning
• The PowerShell Parameter Demystified
6
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Chapter 1 Do the Basics
F urther Learning
• The PowerShell Parameter Demystified
F urther Learning
• How to Use the PowerShell Script Analyzer to Clean Up
Your Code
7
Chapter 1 Do the Basics
C
ode in Context
Write a solution specific to context in which it will run. Don’t write a script
that expects 10 parameters and give it to your help desk staff. Write a GUI
instead. Don’t quickly bang out a script without much thought if it’s going
to be used in production.
Worry about performance if the action your script is taking is time
sensitive. How you code always depends on the context in which it will
run. Don’t assume the code you write and test on your workstation is going
to run fine in another environment. Code in the context that the script will
run in.
F urther Learning
• Clean Code: A Handbook of Agile Software
Craftsmanship
F urther Learning
• PowerShell Format Output View
8
Chapter 1 Do the Basics
F urther Learning
• 10 Steps to Plan Better so You Can Write Less Code
F urther Learning
• Git Basics for IT Pros: Using Git with Your PowerShell
Scripts
9
Chapter 1 Do the Basics
W
rite for Cross-Platform
PowerShell isn’t just on Windows anymore. PowerShell Core is cross-platform
and so should be your scripts. If you ever see a time when your scripts need to
run on other operating systems, account and test for that now.
If you’re sharing scripts via the PowerShell Gallery or some other
community repository, cross-platform is especially important. Don’t let
others find out the hard way your script only runs on Windows.
F urther Learning
• Tips for Writing Cross-Platform PowerShell Code
F urther Learning
• Getting Fancy with Code Just Makes You Look Stupid
10
Chapter 1 Do the Basics
F urther Learning
• PowerShell Tip: Use a Code Editor
11
Random documents with unrelated
content Scribd suggests to you:
“I don’t believe any reality on earth could equal the descriptions
we have had of Niagara. It would need heaven and hell almost to
body forth the ideas that travelers have called up. I can only hope to
be able, if ever I see it, to forget all that I have ever heard about it,
so as to shrink before its magnificence as I should feel bound to do.”
“Suppose we try, Claire?” said I.
“With all my heart,” answered she, evidently glad in her restless
state to be going somewhere. I had previously told her that Herbert
had gone to Quebec.
In a week’s time Claire and myself, with a man-servant, had
reached Albany, and there took the canal-boats to Buffalo. The
wearisome journey by stage-coach had admirably prepared us for
the monotonous ease of the boat. Fortunately there were very few
passengers, and we lay in our little clean white berths and rested
and read as quietly as if we had been in our own rooms.
On reaching the Falls we were too thoroughly wearied to attempt
more that night, and went to our beds.
On our way, a fellow passenger, experienced in sight-seeing, had
recommended to us to take our first view from the American side,
and from below, instead of the usual view from Table Rock. We
therefore crossed the river a little distance below the Falls, without
giving way to the temptation of gazing for a moment at the view
before us, though the roar was terrible in our ears. Then we walked
on the American side, closer, closer till we were within twenty feet of
the cataract. The spray dripped over us, the rocks were slippery to
our feet, the roar of a thousand floods seemed in our bewildered
ears; and below, as it were, the reverberating yells of damned spirits
tossing, and whirling, and dashing and howling forever. Then we
looked up. The volume of water seemed coming down from the very
heavens upon us. We uttered a faint cry of terror—turned round and
fled. That is to say, we fled several yards. No matter. We were
impressed sufficiently with the physical grandeur of the scene. It
was oppressive, overwhelming. Afterward, when we roamed over all
these rocks and took views from every point, and gazed at the
cataract’s wondrous beauty as well as power, we found a moral
grandeur with which our souls sympathized, and to which they rose
to enjoy and adore. These jottings down of our impressions can give
no idea to one who has not visited the Falls, and to one who has,
will scarcely enhance his recollections. I mention them only to
illustrate a trait of Claire’s character.
A mother with her child were wandering along among the loose
stones and sharp rocks close to the terrible whirlpool from which we
had just turned. The mother had let go the child’s hand, and he, a
lad of some four or five years old, slipped from the stone on which
he stood, and as a natural consequence was in imminent danger of
his life. But one rock, and that slippery and sloping, intervened
between the little fellow and certain death. The mother screamed,
but was motionless from mere horror; Claire, who at once forgot
every thing about her but what was connected with the living drama
before her, pulled at a stroke her scarf from her neck, and giving me
one end to hold, while she held the other, slid her feet rapidly down
to the very brink of the torrent, caught the boy firmly by his foot and
stood holding him. She was as pale as death, but as firm and strong
in her attitude as if she stood on the parlor floor. She dared not
move, and I had not strength, and was too distrustful of the
strength of the scarf, to dare to pull them up.
As we stood thus it seemed hours, though it could scarcely be
half a minute before relief was obtained by a rope thrown by a
strong arm from behind over the form of Claire, which fully
supported her in her perilous position. Immediately after she was
clasped in the arms of a man in a cloak, whom we had seen sitting
near us in an absorbed attitude, seemingly regardless of all about
him. He had sprung from his seat, caught up a boat-rope, which I
perfectly remembered afterward to have stepped over, thrown it
around Claire, so as to support her, and then giving the noose to my
servant, who stood close but inactively behind, steadied himself by
the other end of the rope, slipped and sprang down by Claire,
caught up the boy with one hand and tossed him up to his mother,
and then bore the now fainting Claire carefully up to the bank.
The boy screamed wildly with fright, and the mother was voluble
with her thanks and offers of assistance. Claire remained still and
motionless in the arms of the stranger, and I watched the spray dash
over her marble face. Presently her eyes opened slowly, with a deep
sigh. She looked at her preserver and a beautiful color overspread
her face. Then for the first time I also looked at him, for to this
moment no one had spoken but the woman whose carelessness had
put in jeopardy three lives.
He had bent his head down to hers and had kissed her forehead,
rosy with returned consciousness. She replied by pulling her arm
over his neck and kissing, not his forehead, but his very lips. The
woman and her boy had gone, the servant discreetly retired, and
there in the sound and rush of many waters, in the turmoil of
elemental war, the still, small voice of two loving hearts, lately so
near to death, was heard and registered.
“But you wrote me, Herbert, that you were setting off for Quebec
last week. Who could have dreamed of finding you here?”
“And so I did go to Quebec. But I used it up in two days, and
then came on here once more. In my then state of mind it was a
relief to place myself where you found me, and listen to the roar of
the water from morning till night. Now, I don’t care how soon we go
away.”
We did journey, however, for some weeks; and when we returned
and were once more in our own quiet parlor at home, I asked
Herbert to come with me to my room.
“I am going to read you something, Herbert. Something about
Claire.”
Then I opened the packet which Father Angelo had given me.
First there was the official announcement, or rather a copy of it, of
Father Angelo’s admission to the Convent of la Trappe, in Piedmont,
and his consequent death to the world and every body in it. Then a
separate packet contained such particulars of his life as he deemed
necessary for me to know, and to communicate to Claire, if I
thought proper, or to whomsoever she should hereafter marry. There
were also papers conveying a small amount of property to her.
Enough for her subsistence should she be deprived by misfortune of
my support.
The man had been sinned against and was also a great sinner.
He had sinned against the young English girl, Clara, whom he had
seduced from her home under the false pretence of marriage, and
whose fidelity to him and trust in him had continued to her gentle
death. Afterward to win for himself the means of keeping up his
dissipated habits he had recourse to forgery, and had escaped in
disguise, and narrowly, with his life. After that he went to Rome; by
a run of luck in gambling he obtained the means of making a
handsome appearance in society there, and by his cultivation, taste
and fine manners, so impressed an Italian family of some distinction
that he married one of the daughters. The marriage was an unhappy
one. His wife eloped with his friend, and the old drama of a duel was
acted over. Finally his resources were exhausted, and either reason
or conscience suggested to him the claim which a wife and child had
on his memory. At all events, he became an altered man, took holy
orders, obtained permission to travel, and did travel in search of his
long-forgotten wife and child. After a long search he found Claire. He
sought her society. He became her confessor and her friend. He
learned her pure heart, and her enthusiastic devotion to the memory
of her parents. Then the iron entered into his soul. He felt the
impossibility of presenting himself to such an innocent being as the
realization of such an ideal as hers. He now dreaded any chance by
which his relationship could become known to her, as much as he
had heretofore eagerly sought her. All he could do for her he did, but
he constantly watched an opportunity to secure to her an efficient
friend, who could take her into the world, and withdrawing her from
the dull and confined life she then had, put her into the way of
forming connections for herself which would in some degree lead
her to forget or cease to look for her father. The agony of being
forced to deny himself every parental caress, lest he should be
forced to explain his relationship, and consequently the reasons for
his long and unpardonable estrangement, made him wish a
thousand times he were dead indeed, and he said he longed every
hour for the time to arrive when he should take the vow of eternal
silence, for such only harmonized with the gloom of his soul.
It would be wearisome to go through all the details of such a life,
of such talents abused, of such a mournful old age.
We talked the matter over freely and fully, and Herbert concluded
with me that it was best to burn the package, that under no possible
combination of circumstances could it fall into her hands. It should
be his happiness he said to make her forget to look for her father.
How he found out how much she could bless him—and when she
discovered that though he was full of faults, she loved him, faults
and all, I cannot tell; but every body’s experience will furnish similar
instances for themselves or others.
APPEARANCES.
———
BY J. HUNT, JR.
———
Rev. W.——
“My dear W.—Elected! Apart from all nonsense and
affectation I am heartily glad of it! of course I received the
congratulations of every body here quietly, as if it was all a
matter of course that I should be elected Senator, but with
you I have no reserve. Know then, my very dear W., that I
am glad I am elected. For three reasons. First, because I
am elected while just barely of the requisite age: Second,
because I am elected by an overwhelming majority—20 to
1: Third, because it places me out in a free and higher field
of usefulness and energy. Why I feel as if I had just begun
my life. I have not attained the end—only the beginning of
my ambition. I don’t think that it ought to be branded as
ambition—this feeling of mine either. I don’t think it is
ambition. It is a purer feeling—A wish, an eagerness, a
nature to be doing, influencing, bettering as wide a sphere
as I possibly can. I was elected without any art on my part
whatever. I told the people exactly what I was, and what I
intended to try to do if they elected me. I intend to be just
exactly what I am! If I were to try to appear other than
exactly that I would look as well as feel mean—my arm
would falter in every gesture, my tongue stammer, my
knees shake—I would become weak—weak physically,
mentally, utterly! A pure-minded, single-intentioned, whole-
souled manner in thought, word and deed has borne me
thus far like a straight arrow from a true bow. It is the
shortest, best way to cleave the future, I know.
“There is a fourth reason why I do rejoice in my
election. It is because I know that you will rejoice in it. It is
you my friend who have made me high-thoughted and far-
thoughted. It is you who during the last twenty years have
been my good genius—in your conversation when present
with me—in your correspondence when absent from——”
THE JOURNAL
Tuesday night, June.—Well, ’tis over. To-day I arrived in my new
home; and setting aside my longing after a home-feeling, which I
have ever felt since the death of my dear, dear mother, there is no
place that promises more domestic enjoyments than Alton;
especially if Clare, my cousin, will love me and let me love her. She is
a pretty girl, not beautiful, I admit, but sufficiently comely. My good,
kind uncle, too! I can love him, I know; for how careful—how very,
very tender was he of my feelings on our road hither. My room, also,
is very nicely arranged; and as I glance around, I think I may again
be happy, even, though I am dependent on my uncle’s bounty. I
must to sleep now, for I am too sleepy now for aught else.
Monday.—Several days have elapsed since I last wrote; and I
begin to love my old uncle in reality. There is yet another member of
our small family circle, whom I did not see the first day of my arrival.
It is an old lady, claiming cousinship with my Uncle Alton, and
carrying herself with quite an “air” to myself. Very strict, too, she
seems in her religious views; and yet sadly lacking in herself that
charity for others which, in my eyes, is the light, “pure and
undefiled.” Ah, me! I must stop, or I shall be wanting in that which I
am so lauding. How lonely—how very lonely do I yet feel! no nearer
my home of the heart yet, I fear me. My uncle I love; but—my
Cousin Clare is so strange. Can she love, or is she like one of those
incomprehensible characters of whom I have read, who keep all
those feelings hidden deep within their heart of hearts, until they die
away of themselves, leaving them in reality as callous as she now
seems to me. I have tried to settle myself to my usual employments.
I sew, I read, and tune my guitar occasionally; and often wander
out, with my books, into those grand old woods around Alton, and
sitting there under their deep, dark shadows, find companionship in
my thoughts. My Cousin Clare I did ask once to accompany me, but
was refused, on account of household duties; and Mrs. Dudley
added, with an expression of countenance, to emphasize her
speech, “Clare, Miss Walton, thinks of others besides herself. For my
part, I never admired those tramps through the woods, of which
some young ladies are so fond.” And her mouth was settled into that
self-complacent expression, as if perfectly satisfied of the effect
produced on me—imagining that poor I must be abashed into utter
prostration before the majesty of her disapproval. Nevertheless, I
still walk, and will continue doing so, with or without approval, which
I neither value nor seek.
Thursday night, July.—What a difference will the arrival of an
agreeable person make in a country-house. Now, yesterday and to-
day are so rapid, compared with the preceding weeks. There has
been an arrival at Alton. No less a personage than Col. Dudley, a
nephew, by marriage, to my old plague. His health, it seems, is not
very good—and he passes the summer here to re-establish it. He
lives in the “sunny South,” and gives me some glowing descriptions
of it. I have some one now who is in reality a companion; but,
although this seems equally agreeable to me, and to himself, it does
not seem to be relished as well by Mrs. Dudley.
Sunday, September.—Many weeks have elapsed since I have
written in my journal. I have been so happy, that I took no note of
time. Col. Dudley has been my constant companion; and Mrs.
Dudley, his aunt, though always making little plans and plots to draw
him into her own and Clare’s society—from which I am as much
excluded by my own choice, as their habitual reserve—has not
succeeded as yet. I am sure to find him at my side, whether in a
walk or ride. And these same glorious woods—so old, so grand—how
beautiful they are becoming now, as the “melancholy days” draw
nigh. What made the poet say the autumn days were the “saddest
of the year.” I am sure he must have been indulging in a poetical
license, for to me they are infinitely joyous and gladsome. I know—I
feel that Hugh Dudley loves me; and yet why does he not ask me to
be his. Perhaps he waits for a manifestation of my feelings for him;
but that I shall never evince, dearly as I love him. I know that he is
proud—so much so, that much as I love a proud man, it becomes
almost a fault in him. But I am also proud; and where I most love,
there am I always the most reserved. I wish him to know “I would
be wooed, and not unsought be won.”
Wednesday night.—How happy! how immeasurably happy am I!
I can hardly realize these joyous feelings! I have just entered my
chamber, too excited for sleep; and seeing my journal lying close to
the writing-desk, have opened it to put in words, my joy. It appears
unaccountable to me, how, for one moment, I could have imagined
myself happy before, when I compare my present ecstatic feelings to
what I can remember of ever experiencing. It seems that my heart
is opening in love, to the whole world. I could even take Mrs. Dudley
with the kindest affection to it, if she would allow me; but why or
wherefore she dislikes me, and will manifest that feeling for me.
Even my perceptions of the beautiful have grown so much the more
lively; and the meanest thing of earth—the mossy trunk—the
cloudlet—the sky—the stream—the wild-flower—are all floating in an
atmosphere of light and beauty. And why is all this? Oh! my proud
heart, you are now satisfied; and you can answer, why this ecstatic
feeling. I love and I am loved! Hugh Dudley—my own Hugh—has
told me this in words—so wondrously eloquent—and has, at last,
sued me to become his wife. He wished our marriage to take place
at once; but for all sufficient reasons, I have begged him to defer it
till next summer. Then I will go forth with him among strangers—
with him who is my world. I have found at last my home of the
heart. ’Tis in his love—his ardent, disinterested love. And why did I
not marry him at once, and go with him to his own sunny home? I
could not, proud heart that I am, bear to owe the very dress in
which I should be decked at the altar, to the bounty of my uncle—
how much less to Col. Dudley. Though I have a home with them—
that is, shelter and food—yet my right hand should be cut off, ere I
would take pecuniary aid from any. They all look cold upon me now,
even my uncle. I have ever conducted myself respectfully—nay, even
affectionately toward him; but, for some reason or other, he has
altered toward me, and I have drawn myself again into my reserve. I
have undoubtedly thwarted some cherished plan of his, with respect
to Clare and Dudley; but even my dependence on him—gratitude will
not be forced—will not allow me to regret what has happened. Oh!
so contented—so blest am I—that cold looks from the world are
unregarded, so long as I am conscious of his love. I had been sick,
and sad, for two days and more; my heart and head seemed
bursting, for I could hear, in my chamber (where sickness kept me
prisoner) the sound of mirth and enjoyment going on below. Even
the unwonted laugh of Clare was echoing merrily, as if my absence
kindled a fire of joy in her bosom of ice; and my jealous heart told
me she was happy, because of the attentions of Col. Dudley. I could
not endure the thought of his wasting upon her one smile—one
word beyond those of common civility. Very, very wicked was I on
that bed of sickness; for every time I could hear the voice of Mrs.
Dudley calling upon my cousin, in a gladdened tone, I would half
utter aloud, “Yes! that vile old woman is satisfied now. She thinks he
will love that icicle—that automaton.” Yes, wicked I was, indeed; but
then, sick and suffering, I should have been treated with more
sympathy by those under whose roof I then was eating the bread of
dependence, it would have made it less bitter—not near so choking.
One ceremonious visit for the day from Clare—one message of
inquiry from my uncle, was the sole interest that was bestowed upon
me. How can it be wondered at, then, if my heart grew bitter toward
them; ay, even to him, for if he inquired, it was never told me. But
the bitterness I felt toward him was different from that which I felt
toward my uncle and cousin. When I reflected on their conduct,
there was a mingling of anger and revenge; when on him, the tears
would rush to my eyes, an aching feeling to my heart, and I would
say, “Could I only die now, would he shed one tear, or be saddened
by the cold, pale face of her whom he must have known felt
something for him beside mere friendship.” And then I would hide
my eyes in the pillow, and weep in pity over the sad fate of myself
which I thus pictured.
As these bitter, bitter thoughts careered through my brain—
increasing its ache—how did I sigh for the rest of the grave. “For the
living know that they shall die: but the dead know not any thing,
neither have they any more a reward; for the memory of them is
forgotten. Also their love, and their hatred, and their envy is now
perished; neither have they any more a portion for ever in any thing
that is done under the sun.” I snatched my journal—in my longing to
unburthen myself of my weight of wo—and scribbled what I here
transcribe, but which from shame I have since torn out:
“Why, oh Father! didst thou see fit to throw me here in this bitter
world, to suffer and to struggle alone! Alone must I suffer—alone am
I in my love—alone in my despair—and when dying solitary, and I
am bore to the rest of the grave, I shall be unwept, unthought of.
Well! be it so; only, Father, teach me to bow in submission and to
drink without murmuring of the bitter cup. I already look upon the
tomb, as the storm-tossed mariner to his haven of safety, ‘where the
wicked cease from troubling and the weary are at rest.’ Ah! how few
care what the motherless one, cut off from the world by poverty and
other adverse circumstances, must endure. My wishes and my hopes
are mine, and mine alone. I feel, as I imagine the deaf and dumb
one does, whose heart is full of love, and bright, warm, beautiful
fancies, and who cannot give them words. To whom can I utter
them? All, all these feelings must be forever buried in the depths of
mine own sad heart, and nothing but the froth, the foam, and the
weeds, be thrown on the surface for the world’s gaze. Oh! how I
envy those who have fond parents—a dear brother—a loving sister.
How I long for a sympathy—a resting-place for my affections, which
I despair of ever finding on earth, but which I hope I may realize
with Him, the Father, who has given me this capability of loving.”
This was written after hearing what my imagination—heated with
fever and jealousy—construed into a light laugh from Dudley,
immediately under my window. I knew it was him, for I heard the
crashing sound of his boot-heel on the gravel, and the mingling
tones of his aunt and Clare. They had all been walking—for I sprang
from the bed to ascertain the fact. Yes, walking! For Clare was
leaning on his arm; her sun-bonnet dangling by the string from her
hand, and to my jealous eye she had never looked so near to
beautiful. Her cheeks were flushed, and a smile almost loving parted
her lips as she looked up into his face. They had stopped to admire a
flower, over which Mrs. Dudley still leaned, and he—apparently—was
describing some of the same kind he possessed. How I hated Clare,
at the moment, there standing with her hand upon his arm, when
there was no necessity for the support; loving him, too, as I knew
she must—though in what manner I could not picture to myself—for
I had ever thought from her impassable nature it was the blood of
fishes which filled her veins. As I looked upon the group my
dejection became intensified into agony. I felt utterly alone, and I
wished for some kind Samaritan to pour the oil of sympathy into my
bleeding wounds. It was then I wrote, and in the despair of my soul
I felt that all was vanity and bitterness, and that I had deceived
myself entirely—yes, blindly deceived myself. He cared not for me—
whilst I was writhing in pain, he was merrily and gleefully laughing
with those whom he knew, as well as I did, loved me not.
How changed my feelings now from those penned above, wrung
from me by jealousy and despair! ’Tis as if I had been groping in
some dark, noisome cave alone—ay, alone and fearful—and had
suddenly entered an inner chamber, before unknown, where a
thousand lights are dancing and reflecting against its brilliant
columns and gem-like stalactites pendent from its illuminated sides
and dome—so beautiful—so sudden has been the change. To begin
at the beginning and tell how came this change.
For three days had I kept my room. On the afternoon of the third
I stole out unobserved, as I thought, and made my way to the old,
sombre-looking forest—my favorite haunt—where, under its dark,
umbrageous trees, amid its gloom and solitude, I sought for
companionship for my own sad thoughts. Seated on a fallen tree,
turning with my foot the dry leaves listlessly, and hearing the
moaning and sighing of the breeze through the tree tops. No other
sound reached me; but I started up wildly—for sickness had made
me nervous—as a hand was laid upon my arm, and scarcely heard