Wsl bash script or templating inclusive wsl executer

Hello,

i use a lot linux and on windows is my default workspace always in in wsl (Visual Code WSL)
In opus use i current the wsl command to use linux commands like rsync or python stuff and any other like this.

MS-DOS Btach:

@leavedoswindowopen
cd {sourcepath$} 
wsl -e rsync --timeout=600 -rzPchv --info=progress2 -B=131072 --inplace  {file$}  1.2.3.4:upload/dest/

with the cd command under windows go i to current dir and wsl use the current location to go on the correct mount path under linux so this wok for singel commands perfect with relativ paths for me

now the problem with bash scrips i have current 2 options

  1. create a sh script in wsl space and give him only options
  2. create the script on runtime and use it with wsl

both options have the problem from more complexity at 1. i have to maintain a 2. script . problem if i use more computer or wsl sub systeme, i use ubuntu 20, ubuntu 22, archlinux, and debian als wsl container and the option 2 have more problems with escaping and bug hunting and is not so easy.

this is why i a bash script or script generator wand that including only the templating and executing from the script under wsl, inclusive the correct path translating for absolut paths with @options for wsl options and the target shell or so

as example for the idea

@leavewindowopen
@wsl=ubuntu22

#!/bin/bash
or
@shell=bash

while [ 1 ]
do
    rsync --timeout=600 -rzPchv --info=progress2 -B=131072 --inplace --partial {filepath$} dest
    if [ "$?" = "0" ] ; then
        echo "rsync completed normally"
        exit
    else
        echo "Rsync failure. Backing off and retrying..."
        sleep 180
    fi
done

the spezial is hear the correct {filepath$} for wsl mountpoints for the host system fs like /mnt/c/Users/ for C:\Users out of the box or {wslfilepath$} for all?
if this only a templating can any use this for any scripting with outh any owned interpretor or complexity for the opus devs only the finish result is from interesing like command was ok or failed returncode

i hoppe my denglich is not to buggy for u and your undertand me a bit

Thanks for The best Filemanager!

I probably haven't understood everything you're trying to do, but if WSL is installed there should be a WSL mode you can use for the command, instead of the MS-DOS Batch mode. That should mean you don't need to run everything through wsl.exe, and can do things more directly in the button. It'll also ensure that file paths used in the command are converted to the format WSL needs.

U meen the WSL-Scripfunktion? the have no effect or i understand the usage not her a example from me

a window pop fast up and close instand hmm no error and in log is noting to find ;(
the help page is emty.

https://docs.dopus.com/doku.php?id=:customize:creating_your_own_buttons:wsl_commands

Have u any hints how i can use it or on wat level it work?

wat do the WSL-Scripting? create it temp file like the MS-Batch or run it command for command?
wat Shell use it? :slight_smile:

also having problems using WSL through dopus.
WSL installed and working OK when launched directly but when trying a simple ls using FAYT WSL the window just flashes open and disappears.