Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run multiple commands using wsl

I have some scripts on my home folder that I would like to run from command line, actually from the task scheduler, but I don't find the way to do so.

I have tried

wsl -u Ubuntu -u jlanza "cd /home/jlanza/bin && ./myscript && ./myotherscript"

but it doesn't work.

How can I concatenate the execution of several commands under the same session?

like image 394
jlanza Avatar asked May 09 '26 11:05

jlanza


1 Answers

You need to escape && so powershell does not see them as different commands, to pass && to wsl do the following: wsl -d Ubuntu -u jlanza -- cd /home/jlanza/bin `&`& ./myscript `&`& ./myotherscript

like image 107
Fredrik C Avatar answered May 11 '26 08:05

Fredrik C



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!