« first day (3566 days earlier)      last day (1390 days later) » 

7:37 AM
Hi @Braiam. How's it going?
 
 
8 hours later…
3:32 PM
anyone know why a loop like this wouldn't work:
for f in dir/*.out; do
	while read -r some stuff _; do
		printf '%s,%s\n' "$some" "$stuff" | tee -a file
	done < "$f"
done
the while loop inside is reading only the first line from each file
But if I just say like "echo $stuff" inside there it prints them all
 
3:46 PM
it's something to do with the stuff I'm doing inside the while loop but I don't know what it could be. the word break doesn't appear in the script at all
 
@jesse_b It can also be something equivalent to exec 0</dev/null.
 
one of the lines inside the while loop is something like:
`var=$(ssh name@ip 'command')`
if I comment that line out it goes through every line in the files
 
@jesse_b ssh is stealing your standard input, then. You may use var=$(</dev/null ssh name@ip 'command'), maybe?
 
@fra-san That worked, thanks a ton!
 
4:11 PM
I'm probably missing something, because I can't find where in the ssh manual it is stated that commands are read from standard input, and especially that standard input is consumed even when a command is provided as an agument (and then, stdin seems to be simply discarded).
 
4:23 PM
(Uhm, no, I was wrong, of course: the local standard input is made available as the remote standard input to the command given to ssh as an argument).
 
Tim
I am sucked into logic books and can't get out. Help
with some good books
Anyone having studied in logic?
Does knowledge of logic help you in some ways?
in computer science, most likely
 
@fra-san ah does that mean the rest of my loop was being sent to stdin of the first server it ssh'd to?
 
@jesse_b Yes.
 
5:23 PM
@jesse_b I was bit by the same (I think it's the same) issue in a perl script I was writing. It was absolute hell to debug and I only solved it eventually because of Gilles's great answer here:
6
A: SSH connections running in the background don't exit if multiple connections have been started by the same shell

Gilles 'SO- stop being evil'Foreground processes and terminal access control To understand what is going on, you need to know a little about sharing terminals. What happens when two programs try to read from the same terminal at the same time? Each input byte goes randomly to one of the programs. (Not random as in the kern...

 
@terdon awesome thanks!
 
3 years down the line, all I remember is "ssh plus stdin BAAAAD". But that's usually enough to let me zero in on the problem :)
 
@terdon I'm just curious when you migrated Kali question to meta, what happened to the duplicates linked? Were they delinked? I know many of them would have deleted by the system a.k.a. the Community bot but what about the ones which had some answers or had a postive score which still exist on the site?
(I pinged you since you're a mod and have more insights than a normal user)
 
5:39 PM
@Kulfy I can still see them in the sidebar of the original question (it has now been deleted by Community). So I guess they aren't delinked.
But visiting one of the linked questions (unix.stackexchange.com/q/273941/22222) I can see that the old Kali question isn't linked from it.
So, the links are still shown on the old, deleted question, but existing questions are no longer shown as linking to the deleted one.
 
Ah the question title now has [migrated] in the banner
Also, did Gilles lose some reputation points since it was a highly voted post?
 
Well, if he did, I doubt he'd notice! :)
But probably not, you don't lose rep if old posts are deleted.
 
I think if highly voted posts are deleted. (highly voted means having score>=5, I guess)
 
Looks like it's 3
> First, reputation earned for posts with a score of 3 or higher, and where the post has been visible on the site for at least 60 days, is retained. This includes reputation gained from approved suggested edits on such posts.
360
A: How does deleting work? What can cause a post to be deleted, and what does that actually mean? What are the criteria for deletion?

jjnguyHow can a post be deleted? By users: The author can typically delete their own posts at will; for exceptions, see When can't I delete my own post? below. To delete a post, just use the delete link below it, on the left (only available from a browser, not the SE/SO app). Moderators can delete an...

 
Excellent.
 
6:02 PM
@terdon And this also seems to explain the difference between echo foo | { sh -c ':'; cat -; } and echo foo | { ssh user@host ':'; cat -; }, which is what I was wondering about. Thanks!
 

« first day (3566 days earlier)      last day (1390 days later) »