Reputation: 11
I want to unzip a folder with multiple *.7z archives, all with same password.
Unfortunately, using this:
#!/bin/bash
password="12345678"
cd /server/disc/folders.../folderWithArchives
for package in ./*.7z;
do
7z -x -P{$password} $package
done
gives me
Error: Incorrect command line
Have you any ideas how to fix it?
I've tried shellcheck and it gave me this:
#!/bin/bash
password="12345678"
cd /server/disc/folders.../folderWithArchives || exit
for package in ./*.7z;
do
7z -x -P$password "$package"
done
but it still doesn't work
OS: Ubuntu 16.04.6 LTS
shell: GNU bash, version 4.3.48
Upvotes: 0
Views: 2677
Reputation: 11
I found a solution. Everything works OK after only deleting '-' before 'x'. Now it works and looks like this:
#!/bin/bash
password="12345678"
cd /server/disc/folders.../folderWithArchives || exit
for package in ./*.7z;
do
7z x -P$password "$package"
done
Upvotes: 1