Re: check, that a script is in a folder

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

 



solved:

if ! [ "${PWD##*/}" == "ASDF" ]; then echo "error: not the ASDF dir"; exit 1; fi

--- On Wed, 1/5/11, Rodolfo Alcazar Portillo <nospaze@xxxxxxxxx> wrote:

> From: Rodolfo Alcazar Portillo <nospaze@xxxxxxxxx>
> Subject: Re: check, that a script is in a folder
> To: "Community support for Fedora users" <users@xxxxxxxxxxxxxxxxxxxxxxx>
> Date: Wednesday, January 5, 2011, 2:39 PM
> On Wed, 2011-01-05 at 02:28 -0800, S
> Mathias wrote:
> > $ echo ${PWD##*/}
> > somefolder
> > $ if "${PWD##*/}" -eq "asdf" > /dev/null; then echo
> "this is the asdf folder"; else exit 1; fi
> > bash: notthatfolder: command not found...
> > this is the asdf folder
> > $ 
> 
> /home/rodolfoap > mkdir asdf
> /home/rodolfoap > cd asdf
> /home/rodolfoap/asdf > if [ "${PWD##*/}" == "asdf" ];
> then echo "this is the asdf folder"; else exit 1; fi
> this is the asdf folder
> 
> > What's wrong with my one-liner?
> 
> Strings comparison are built with "==" (posix is "=", both
> works),
> integers compare with "-eq". Also, the test command ( or [
> ) is
> required.
> 
> Greets!
> ----------------------------------------------
> Rodolfo Alcazar Portillo - nospaze@xxxxxxxxx
> otbits.blogspot.com / counter.li.org: #367962
> ----------------------------------------------
> "Absolutely nothing should be concluded from these figures
> except that
> no conclusion can be drawn from them." ~ Joseph L.
> Brothers
> 
> 
> -- 
> users mailing list
> users@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe or change subscription options:
> https://admin.fedoraproject.org/mailman/listinfo/users
> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
> 


      
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux