[Techtalk] once again frustrated by bash :(

Kai MacTane kmactane at GothPunk.com
Tue Mar 9 14:51:28 EST 2004


At 3/9/04 01:32 PM , Angelina Carlton wrote:
>I cannot see how to test if an argument is a directory or a file.
>
>#!/bin/bash
>if [ -d = "$1" ] ;
>then...

Bash's -d is a unary operator; you just do:

if [ -d "$1" ];

No equals sign necessary.

                                                 --Kai MacTane
----------------------------------------------------------------------
"Among my own I was alone... through my own doing."
                                                 --VNV Nation,
                                                  "DarkAngel"



More information about the Techtalk mailing list