severndigital Posted November 3, 2010 Share Posted November 3, 2010 I can't get this simple bash script to work .. can someone please tell me what i am doing wrong? LIST=$(ls "$1") for item in ${LIST[@]} do if[ -d $1$item ] then echo "$1$item is a directory" else echo "$1$item is NOT a directory" fi done if I replace the if statment with just an echo $1$item, it returns the correct value. but when I run this script I get this .. dir_mon_notify.sh: line 16: syntax error near unexpected token `fi' dir_mon_notify.sh: line 16: ` fi' no matter what I do, I can't get it to work .. any help would be great. Link to comment https://forums.phpfreaks.com/topic/217672-bash-what-am-i-doing-wrong/ Share on other sites More sharing options...
trq Posted November 3, 2010 Share Posted November 3, 2010 You need to ensure there is a space between if and [ Link to comment https://forums.phpfreaks.com/topic/217672-bash-what-am-i-doing-wrong/#findComment-1130082 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.