IF statement help
Matthew Flaschen
matthew.flaschen at gatech.edu
Fri Nov 13 05:42:35 UTC 2009
matteo filippetto wrote:
> Hi,
>
> maybe you can
>
> folder_source=""
>
> if [ -d /$folder1_source/$1 ]; then
>
> folder_source=1
>
> elif [ -d /$folder2_source/$1 ]; then
>
> folder_source=2
>
> elif [ $folder_source="" ] || [ $folder_source="1" ] && [
> $folder_source="2" ]; then
This is incorrect. First, either the if or the elif could execute but
never both. Even if they did both execute, folder_source obviously
can't equal two different values at the same time.
Nils's solution appears correct.
Matthew Flaschen
More information about the ubuntu-users
mailing list