Fork me on GitHub
#off-topic
<
2016-12-06
>
pesterhazy13:12:51

General Unix question: I have a command that returns something, e.g. a filename, on stdout. What I'd like to have is a way to refer to that text, usually the last line of output, without moving the mouse.

pesterhazy13:12:27

Has anyone found a way to do that? Ideally without re-running the command.

poooogles13:12:40

export SOME_VARIABLE=$(command | tail -1) ?

pesterhazy13:12:02

hmm yeah, although that does re-run the command

poooogles13:12:12

eh, at export time yes.

poooogles13:12:17

then it's just there.

pesterhazy13:12:35

my use case is that i run something interactively, and only then realize that I may need the output

pesterhazy13:12:50

sort-of like *1 in the clojure repl

poooogles13:12:08

you might be able to do that with ohmyzsh?

pesterhazy13:12:23

I'm using zsh, so open to zsh-based solutions!

pesterhazy13:12:27

any pointers?

poooogles13:12:50

not without digging into it, don't use it I'm afraid.

hunter13:12:29

for bash and zsh, AFAIK, the answer to your question is there is no equivalent of *1 in clojure repl

hunter13:12:03

pesterhazy : is it something you could solve with judicious use of pipes/xargs/etc instead?

dexter14:12:24

if its the same command you could alias the command to export SOME_VARIABLE=$(command | tail -1)

dexter14:12:16

or if you set your cli to log to a file you could always just tail your console log

dexter14:12:32

I tend to do that in screen a lot

pesterhazy16:12:32

@hunter, yes I probably could

pesterhazy16:12:56

but it would just be so damn useful to be able to refer to the script's output without copy'npasta

pesterhazy16:12:13

it's the shell's blind spot

pesterhazy16:12:30

ok, bash/zsh have many many blind spots, but it's one of them

dominicm16:12:56

Well, given that stdout is a file. You could probably firehose it into a file. And read it back later.

pesterhazy16:12:02

@dexter perhaps the terminal emulator would be the best place to get this

dominicm16:12:21

term codes & such would be problematic I guess. But otherwise.

hunter16:12:07

pesterhazy if you use eshell in emacs, you would have a *1 style enironment var

dominicm16:12:24

Did somebody suggest change OS yet? 😄

pesterhazy16:12:25

don't use eshell and would prefer not to

dominicm16:12:44

You might have some luck in stracing your zsh stdout.

dominicm16:12:17

Alternatively, something like script might be suitable for this also

dominicm16:12:39

http://unix.stackexchange.com/a/323920 automatic starting of script in bash 😄

gdeer8117:12:27

who thought that was a good idea?

dpsutton17:12:57

was there an article in there? I know they are trying to go more mainstream and focus on articles

gdeer8117:12:21

it could be cover to cover with articles about distributed computing and quantum physics, it still objectifies women on the cover. Also, playboy will always have a reputation no matter what they try to focus on. Try keeping a playboy on your desk at work and explaining to your boss that it's all about the articles now.

fellshard17:12:57

Is there a correlation, I wonder, between Drupal + PHP and this? 😐

donaldball17:12:56

https://erikbern.com/2016/12/05/the-half-life-of-code.html was a pretty interesting exploration of how long source code tends to survive in various projects

donaldball17:12:07

I ran the code against clojure and got this:

donaldball17:12:34

Largely as I expected; clojure code tends not to go away. But there’s an odd discontinuity at 2014. Anyone know what they might reflect?

fellshard17:12:06

I'm guessing Clojure didn't shift to that, actually.

donaldball17:12:41

I was thinking maybe transducers

dpsutton17:12:18

@gdeer81 i wasn't trying to justify an obviously bad choice. I was just wondering if there was some motivation that I wasn't aware of

gdeer8118:12:01

@dpsutton whatever the intent they didn't think about the impact. Nothing screams "boyz club" like a stack of mags

dpsutton18:12:28

just wondering if it was an insane decision or a very clumsy decision

gdeer8118:12:56

@donaldball I was about to go to lunch before you posted that, now I'm sitting here pouring through the clojure commit history in 2014 while my tummy is rumbling lol

gdeer8118:12:36

looks like it might have actually been late 2013

jr18:12:34

seems to coincide with 1.6 release

tokenshift18:12:19

It looks like almost all of the drop was circa 2007 code going away (that’s the only bar that got smaller, the others just shifted as a result)

tokenshift18:12:32

Not sure what was done in 2007 that went away in 2014, though

dpsutton18:12:03

was something pulled out of core into a library or something?

tokenshift18:12:15

From the blog post, it looks like the stats are based on git blame; so it could have been somebody just moving a folder tree

donaldball18:12:46

ha, that seems a likely explanation

jr18:12:25

lots of internal changes like src/jvm/clojure/lang/Var.java

Alex Miller (Clojure team)18:12:51

I assume it was changing our internal asm version

Alex Miller (Clojure team)18:12:23

We dropped the old one and added the new one

Alex Miller (Clojure team)18:12:48

Probably the biggest delta I ever committed

donaldball18:12:51

Different projects with different use cases to be sure

gdeer8118:12:19

adding Murmur3 looked like a big change as well

Alex Miller (Clojure team)19:12:08

the asm version change is the only case I can recall where I straight up deleted a big wad of code and replaced it

gdeer8119:12:04

it was interesting going through all of the commits

gdeer8120:12:01

yeah some were mundane like updating doc strings and whatnot, but there are some interesting commits in there 😃

Lone Ranger21:12:37

anyone go to the conj?

gdeer8121:12:20

yes, the first one. I even got my Clojure Applied book signed 😃

Lone Ranger21:12:06

wooooo awesome 😄

Lone Ranger21:12:22

how does it compare to just watching the videos online?

dpsutton21:12:25

the videos are excellent. the incredibly nice and brilliant people you meet at an alex miller conference are what really makes it

gdeer8121:12:35

it's way better in person. there's no substitution for the hallway discussions

Lone Ranger21:12:33

outstanding. Was really hoping to catch the datomic pre-conference workshop but alas 😄

gdeer8121:12:36

Yeah I went to that as well, you missed out

gdeer8121:12:44

luckily the documentation and videos for Datomic are really good

Alex Miller (Clojure team)21:12:02

@gdeer81 maybe we should just pre-record the talks, play them in an empty room, and hang out in the hall

dpsutton21:12:27

i have skipped talks and talked in the hallway knowing i could watch them later

dpsutton21:12:31

so we're kinda halfway there

gdeer8121:12:46

@alexmiller I was referring to the discussions between talks and on breaks, but yeah I did meet people that said they miss most of the talks and just talk to people in the halls

fellshard21:12:32

Hope to attend one someday. Maybe West...

mitchelkuijpers21:12:38

Really need to go to EuroClojure next year had such a blast 2 years ago