Sample Header Ad - 728x90

How to use unison-jz inside a bash script?

2 votes
0 answers
273 views
unison-jz works well on a bash command-line but not inside a script. It seems that inside the script, it falls back to the regular unison command. Can someone tell me how to use unison-jz inside a bash script? ---------- I had the unison version conflict that is described in #583058 and the proposed solution for ubuntu works fine on an interactive shell. However, I want to do the same from inside a bash script: #!/bin/bash unison profile_name -sshargs '-i ~/.ssh/privatekey' This is a MWE version of the script.sh (in reality the script is more copmlex, but I checked this MWE and it shows the same faulty behaviour). When I invoke this script from the same command line as before (but also from another shell), it seems that inside the script, the regular unison version is used instead of the snapped unison-jz (which is used when invoking from the interactive shell). Hence, the syncing fails with the same *Fatal error* as before, saying "This can happen because you have different versions of Unison installed on the client and server machines", which I had fixed with the above approached. How can I make the shell script use the snapped unison-jz version instead of unison? Both client and server use bash shell on ubuntu (client: 20.04, server: 18.04). ---------- What I've done on the command-line: 1. Install snap: sudo snap install --devmode unison-jz 2. Add this line to my unison profile file: servercmd = /snap/bin/unison-jz.unison -ui text 3. Comment out line 19 in /etc/ssh/ssh_config so that is looks like # Include /etc/ssh/ssh_config.d/*.conf 4. Execute unison: unison profile_name -sshargs '-i ~/.ssh/privatekey' This works fine from an interactive bash shell.
Asked by dani (21 rep)
Dec 8, 2021, 12:54 PM
Last activity: Dec 13, 2021, 12:52 PM