115 reputation
6
bio website
location
age
visits member for 2 years, 6 months
seen Nov 30 at 21:51

Nov
19
awarded  Popular Question
Sep
10
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
Thanks for helping, Ctark!
Sep
9
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
okay, thanks. That's a nice solution.
Sep
9
accepted Shell script: ssh to remote machine, then exit: 'exit' does not work
Sep
9
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
When I move date "inside", I obtained date: Undefined variable. As this was a shell issue, I included the statement bash right before the date variable (in order to change to a bash so that the date is defined), but then I obtained bash: -c: option requires an argument.
Sep
9
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
Hi R J, thanks for helping. I prefer the first solution (I was aware of the second). However, I get Pseudo-terminal will not be allocated because stdin is not a terminal. Warning: no access to tty (Bad file descriptor). Thus no job control in this shell. But the commands are executed as expected.
Sep
7
awarded  Commentator
Sep
7
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
If I do that (and have the linebreaks accordingly; see the update above), I get bash: -c: option requires an argument and date: Undefined variable..
Sep
7
revised Shell script: ssh to remote machine, then exit: 'exit' does not work
added 127 characters in body
Sep
7
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
Hi,I updated the original post with a not-so-minimal version. As you can see, it's essentially a script for doing a backup to a remote machine via rsync. The actual rsync command is a bit more tricky, but that shouldn't play a role.
Sep
7
awarded  Editor
Sep
7
revised Shell script: ssh to remote machine, then exit: 'exit' does not work
added 442 characters in body
Sep
7
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
The ...batch -c approach is best (as it also solves another minor issue I had with the script). However, the observation remains: If I write the statements on different lines, I get the Unmatched '. errors/warnings. Only if I write them on the same line (;-separated), then it fully works. Strange (?) as it seemed to work on the website you point to.
Sep
7
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
It contains a lot information, thanks. But it does not suggest the 'general best' approach. The EOF-based approach did not work for me (same reasons as in the link you provided). I then tried the "bash -c" approach. But if I encapsulate the code in "'...'" as suggested, I obtain 2x Unmatched '.. If only use one pair of quotes (either single or double), I get bash: -c: option requires an argument. The code is executed, so we are close :-)
Sep
7
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
... but indeed you are right. If I put everything in one line, the 'exit' works. Hmmm... but the script is then not readable anymore :-( can one use curly braces or some kind of grouping?
Sep
7
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
Hi, thanks for helping, I checked the script and I had two newlines there, so that wasn't the issue.
Sep
7
comment Shell script: ssh to remote machine, then exit: 'exit' does not work
Hi Ctark, thanks for helping. There are no special characters involved Obviously, the 'echo' here is just a minimal example; there are various lines of code to be executed remotely. I'm thus not sure how much this "writing everything in one line" should help... there are indeed several lines of code
Sep
6
asked Shell script: ssh to remote machine, then exit: 'exit' does not work
Jun
4
comment How can I use encryption with Gmail?
@laika I don't see any SSL related settings in Settings -> General (June 2014; maybe it has (even) been removed).
Apr
21
comment Printing slides via lpr: How to get 4-up in landscape correctly?
Thanks, Martin, that does it.