From: Joel Reicher <joel.reicher@gmail.com>
To: "KARR, DAVID" <dk068x@att.com>
Cc: tpeplt <tpeplt@gmail.com>,
"Help-gnu-emacs@gnu.org" <Help-gnu-emacs@gnu.org>
Subject: Re: How to get eshell to do what I used to do with shell
Date: Sun, 11 Aug 2024 21:27:34 +1000 [thread overview]
Message-ID: <86bk1zl2op.fsf@gmail.com> (raw)
In-Reply-To: <DM3PR02MB102560F5AA25E232F2105ED0D9DBB2@DM3PR02MB10256.namprd02.prod.outlook.com> (DAVID KARR's message of "Sat, 10 Aug 2024 19:52:48 +0000")
"KARR, DAVID" <dk068x@att.com> writes:
> Section 1.1 mentions an obscure way of filtering ls output,
> using an example like “ls -lt **/*.doc(Lk+100aM+6)”. I couldn’t
> get any variation of that to work. It’s not clear whether it’s
> saying that is eshell functionality, or something about the
> most common implementations of “ls”.
Why do you think ls is doing anything interesting there?
> When I do something simple like this: “ls -l | grep "txt" |
> sort”, all the output lines are prefixed with “(standard
> input):”. I haven’t searched through the info manual yet, but I
> asked github copilot about this, and it said that “eshell/grep”
> instead of “grep” would fix that, but that didn’t work either (I
> don’t expect everything from copilot to be 100% accurate).
Keep in mind that when you execute a command line in eshell,
you're executing some lisp, because eshell is written in lisp.
Depending on your configuration, the behaviour might be to execute
a lisp function (if there is one), and that's probably the case
with grep. If eshell fails to find a lisp function matching the
command's name, it will then attempt to find an external program
by that name.
Also - and this is very important - that pipe is implemented in
lisp.
Both of these things can be overridden on demand by using the '*'
character. For example you can force grep to call the external
program by running
*grep
instead.
Compare the output of
grep blah foo
and
*grep blah foo
(the difference is much clearer if you do not use pipe to begin
with)
For pipes, you can do
grep blah foo *| grep something
and this will force the use of an external shell implementation of
pipe which, as far as I know, implicitly forces an external
program to be used for both commands too. There may be situations
you want the in-lisp pipe (such as piping to a lisp function
instead of an external program).
You may also find this useful.
https://www.masteringemacs.org/article/complete-guide-mastering-eshell
Cheers,
- Joel
next prev parent reply other threads:[~2024-08-11 11:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-10 17:00 How to get eshell to do what I used to do with shell KARR, DAVID
2024-08-10 19:10 ` tpeplt
2024-08-10 19:52 ` KARR, DAVID
2024-08-10 22:32 ` tpeplt
2024-08-11 11:27 ` Joel Reicher [this message]
2024-08-10 21:01 ` James Thomas
2024-08-10 21:06 ` KARR, DAVID
2024-08-11 9:49 ` James Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86bk1zl2op.fsf@gmail.com \
--to=joel.reicher@gmail.com \
--cc=Help-gnu-emacs@gnu.org \
--cc=dk068x@att.com \
--cc=tpeplt@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).