Reputation: 51
I'm trying to upload some zip files to Azure blob storage using this script:
#!/bin/bash
# Sample script to upload a file to a BLOB container
if [ $# -eq 0 ]
then
echo "Please specify a filename"
exit 1
fi
# Required parameters
file_name=$1
azure_account=xxx
azure_key=xxx
container_name=xxx
blob_name=xxx
# Used by azure-cli
export AZURE_STORAGE_ACCOUNT=$azure_account
export AZURE_STORAGE_ACCESS_KEY=$azure_key
azure storage blob upload $file_name $container_name $blob_name
But whenever I run it I get:
sh upload-file.sh file.zip info: Executing command storage blob upload error: Cannot call method 'substr' of null info: Error information has been recorded to /home/usr/.azure/azure.err error:
storage blob upload command failed
Upvotes: 1
Views: 90
Reputation: 141512
I'm assuming you're on Windows. The following works from PowerShell on my machine.
sh upload-file.sh file.zip
The #!/bin/bash
at the beginning of your script means that it is supposed to use bash
to execute. Do you have bash installed? Check via bash --version
.
> bash --version
GNU bash, version 3.1.23(6)-release (i686-pc-msys)
Copyright (C) 2005 Free Software Foundation, Inc.
If you do not have bash then install it. The way that I installed bash
on Windows was via msysGit. This installs what is called git-bash along with Git for Windows. There are other ways to install bash on Windows such as win-bash and cygwin, though I do not have any familiarity with those.
Upvotes: 0