So I had this question earlier and it got answered "Terminal - Zip multiple directories into separate zip files with password" however I couldn't find out how I can use a password with special characters like !@#$. I tried the typical solutions:
- Enclose the whole password string in " " or ' '
- / before every special character.
Nothing worked. This is the command that worked for me except that the password was never set correct (in my attempts it was either set to something different from what I intended, or wasn't set all together)
for i in */; do zip -r "${i%/}.zip" "$i" -p "mypassword!@#$" ; done
'strong quotes'
rather than"weak quotes"
around the password? Alternatively, put the password into a variable and use-p "$password"
. – DopeGhoti Jun 16 '17 at 20:54