Subj : Basic script help To : Avon From : Zip Date : Sat Aug 07 2021 08:28:06 Hello Avon! On 07 Aug 2021, Avon said the following... Av> #!/bin/bash Av> # check for and process incoming door files if found Av> cd /bbs/mystic/echomail/in Av> Av> if [ -f /bbs/mystic/echomail/in/*.GAL ] Av> cd /bbs/doors/gd Av> ./GalacticDynasty maintenance; Av> fi Ah, you have a missing "then" after the if. But you cannot use the wildcard expansion to check for files; -f expects exactly one argument and the wildcard might expand to none or multiple files... I can think of two approaches: #!/bin/bash if [ ! -z "$(find /bbs/mystic/echomail/in/ -xdev -mindepth 1 -maxdepth 1 -type f -iname '*.GAL' -print -quit)" ] then cd /bbs/doors/gd || { echo "ERROR: Could not switch to GD directory! " >&2; exit 1; } ./GalacticDynasty maintenance fi It checks for those files, case insensitive, exactly in /bbs/mystic/echomail/in (not in subdirectories!), and produces a full path to (only) the first such file it finds. This satisfies the if, which calls maintenance. Or: #!/bin/bash for f in /bbs/mystic/echomail/in/*.[gG][aA][lL] do [ -e "$f" ] || break cd /bbs/doors/gd || { echo "ERROR: Could not switch to GD directory! " >&2; exit 1; } ./GalacticDynasty maintenance break fi This one uses a peculiarity with the filename globbing of the shell. If the wildcard matches no files, $f will be the verbatim string "/bbs/mystic/echomail/in/*.[gG][aA][lL]", which should never match any file on disk. Inside the for loop, we check if the "current" file exists or not. If not, there were no matches at all, and we break the for loop and do nothing. Otherwise, we perform maintenance, and break the for loop after the first round (no need to run maintenance for each file). Hope this helps! Best regards Zip --- Mystic BBS v1.12 A47 2021/08/05 (Linux/64) * Origin: Star Collision BBS, Uppsala, Sweden (21:1/202) .