Today is my first day in shell scripting.
I am not able to find error.
Need Help!
Error is :-
syntax error near unexpected token `then'
test.sh: line 50: ` if[-n "$patha"]; then
echo "Enter Path o(if empty file will be unzipped to /var/www/):" read path
echo "Enter Old domain name(default is local.cms.com):"
read old
if[-n "$path"]; then ======>Error in this line.
if [ -n "$old" ]; then
grep -r "$old" "$path"
echo "Enter New domain name:"
read new
if [ -n "$new" ]; then
grep -rl "$old" "$path" | xargs sed -i "s/$old/$new/g"
else
echo "Cannot be empty"
fi
else
old="local.cms.com"
grep -r "$old" "$path"
echo "Enter New domain name:"
read new
if [ -n "$new" ]; then
grep -rl "$old" "$path" | xargs sed -i "s/$old/$new/g"
else
echo "Cannot be empty"
fi
fi
else
echo "Invalid Path"
fi