Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-28-2005, 01:02 PM   #1
Senior Member
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
Problem with unix if statement

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

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

for A in /home/*; do
if[ -f "$A/.bash_history" ]
Old 07-28-2005, 01:07 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
Put a space between if and [
Old 07-28-2005, 01:41 PM   #3
Senior Member
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
Old 07-30-2005, 05:24 PM   #4
Registered: May 2005
Posts: 378

Rep: Reputation: 33
Remember that '[' is actually the name of a program.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unix Shell Programming If Statement ']['HeBroken Programming 2 12-06-2004 04:21 PM
Unix Book for Beginners (Not Linux... Unix) suse2166 General 6 11-25-2004 12:46 PM
Bad switch statement (problem in the code block?) nifflerX Linux - General 2 07-14-2004 04:45 PM
Why did you experienced users of Unix change to unix over Windows? Laptop2250 Linux - General 11 10-28-2003 12:51 PM
How to schedule unix script periodically from unix os level??? gopi_20us Programming 2 03-11-2002 07:45 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration