[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash commands



You need to enclose the whole statement after -n in quotes:

if [ -n "`df /mnt | grep -ie /dev/hdc1`" ]; then echo yes; fi

HTH

Martin

Begin  Russell  quotation:
> Russell wrote:
> > 
> > Hi,
> > 
> > When i try a command like:
> > 
> >   debpc:# if [ -n df /mnt | grep -ie "/dev/hdc1" ] echo "yes"
> > 
> > then after i press "return", i get a command prompt ">" which
> > seems to be waiting for more input. Why does that happen?
> 
> sorry, i missed out some things. I think the promp > happens when
> the statement is unfinished (no "fi"). Should be:
> 
>   debpc:# if [ -n df /mnt | grep -ie "/dev/hdc1" ] ; then echo "yes" ; fi
> 
> However, this gives the error:
>   [: missing ']'
>   grep: ]: No such file or directory
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

-- 
pgp public key at http://ocsc.ormond.unimelb.edu.au/~mstrauss/pgp_key.asc
or send email with subject: request key

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/E/MU d? s: a--- C++++ UL+++++$ P++ L++(+++) E--- W+++ N+++ o+ K?
w--- O- M-- V- PS+++ PE Y++ PGP+++ t- 5- X- R+++ !tv b++++ DI+++
D+(+++) G++++ e* h++ r% y+
------END GEEK CODE BLOCK------

Attachment: pgp1_B6T78hrP.pgp
Description: PGP signature


Reply to: