Why can't I create a directory by full relative path argument? Here is what I try:
#!/bin/bash
args=("$@")
# Print the command and run it. Exit the script on failure.
run()
{
if $VERBOSE; then
echo "$@"
"$@"
else
"$@" >& /dev/null
fi
result=$?
if [ $result -ne 0 ]; then
exit $result
fi
}
if [ ! -d ${args[0]} ]; then
run mkdir -p ${args[0]}
fi
run cd ./release/
run cp -rf ./html/ ${args[0]}
but I get:
mkdir -p ./bla/bla/cloud/
cd ./release/
cp -rf ./html/ ./bla/bla/cloud/
cp: cannot create directory `./bla/bla/cloud/': No such file or directory
So I wonder how to make script work when called like this: ./script.sh ./bla/bla/bla/
