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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux