#!/bin/bash # Define the function to run the scp command for a specific value of j run_scp() { # studio id id=$1 # version number j=$2 # job prefix job=hour-colors-20240303-${j} # name of file (locally) out=hour-a${j}.mp4 # name of file (remotely) input=colors/lightning_logs/version_0/a0.mp4 scp ${id}@ssh.lightning.ai:/teamspace/jobs/${job}/work/${input} ${out} } # Export the function so that it can be used by parallel export -f run_scp # Run scp command in parallel with 2 threads for j in 1 and 2 parallel -j 2 run_scp ::: {1..3}