This is my code:
#!/bin/bash
if [[ -d ~/viwiki ]]; then
cd ~/viwiki
else
mkdir ~/viwiki
cd ~/viwiki
fi
if ! [[ -d ./log ]]; then
mkdir log
mkdir log/log
mkdir "log/wget"
elif ! [[ -d ./log/log ]]; then
mkdir log/log
elif ! [[ -d "./log/wget" ]]; then
mkdir "log/wget"
fi
When running, it has errors:
tuankiet65@UbuntuPC:~$ sh viwik/test2.sh
viwik/test2.sh: 2: viwik/test2.sh: [[: not found
viwik/test2.sh: 8: viwik/test2.sh: [[: not found
How can I fix this?
[[
is ancient, added bash-2.02, released April 1998../{script}
(afterchmod u+x
), notsh {script}
mkdir -p ~/viwiki/log/{log,wget}