LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Problem with unix if statement (https://www.linuxquestions.org/questions/programming-9/problem-with-unix-if-statement-347694/)

abefroman 07-28-2005 12:02 PM

Problem with unix if statement
 
I getting the folowing error with my if then statement. What am I doing wrong?

./clearhis.sh
./clearhis.sh: line 4: syntax error near unexpected token `then'
./clearhis.sh: line 4: `then'

cat clearhis.sh
#!/bin/bash
for A in /home/*; do
if[ -f "$A/.bash_history" ]
then
>"$A/.bash_history"
fi
done

keefaz 07-28-2005 12:07 PM

Put a space between if and [

abefroman 07-28-2005 12:41 PM

Thanks!

eddiebaby1023 07-30-2005 04:24 PM

Remember that '[' is actually the name of a program.


All times are GMT -5. The time now is 07:18 PM.