To bypass all the folders in the current directory allows construction
for d in */; do; ...; done
Thus, the script will take the following form:
#!/bin/bash for d in */ do echo "Zipping folder \"$d\"..." zip -m $d.zip $d done
Keep in mind that the script "does not see" hidden directories (whose names begin with a dot) and does not work correctly if there are no subdirectories in the current directory.
The following script is deprived of all these shortcomings, using the find in its work:
#!/bin/bash for d in $( find . -maxdepth 1 -type d ! -path . ) do echo "Zipping folder \"$d\"..." zip -m $d.zip $d done
The first script also processes symbolic links, the second one skips them. If they also need to be processed, add the -L switch to the find :
find -L . -maxdepth 1 -type d ! -path .