I found that a great way to zip folders into their own zip files is through this loop:
for i in */; do zip -r "${i%/}.zip" "$i"; done
But I wanted to do this all in the background (e.g., nohup &), but I cannot get it to work. How do I do this?
You could execute your commands as a shell script, e.g.
nohup sh -c 'for i in */; do zip -r "${i%/}.zip" "$i"; done' &
The request is to do the compression in parallel.
nohup sh -c 'for i in */; do zip -r "${i%/}.zip" "$i" & done' &
This will start one zip for each subdirectory. These jobs are started under a common nohup, which is itself backgrounded.
zip -r "${i%/}.zip" "$i";withnohup zip -r "${i%/}.zip" "$i" &- note in particular there is no semicolon after the&