[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lazy man's "pkg_delete" (terrible script - help!)
- To: misc@openbsd.org
- Subject: Re: lazy man's "pkg_delete" (terrible script - help!)
- From: Chuck Yerkes <chuck+obsd@2003.snew.com>
- Date: Wed, 1 Jan 2003 10:34:15 -0800
- Content-Disposition: inline
- Mail-Followup-To: Chuck Yerkes <chuck+obsd@2003.snew.com>,misc@openbsd.org
- References: <Pine.NEB.4.33.0212302252570.19544-100000@iceland.freeshell.org>
- User-Agent: Mutt/1.2.5i
cd /var/db/pkg; pkg_delete xm*
1) your version (without the cd) leaves the shell to expand xm* which
varies, depending on the cwd.
2) bash is not part of openbsd. Please leave your linux haven
and understand that many things port easily to Linux, but
many Linux programmers write crap that can't be ported out
of Linux. Use the Posix shell.
3) it would be handy if pkg_* would strip off paths for
pkg_delete /var/db/pkg/xm* to work.
Quoting poff@sixbit.org (poff@sixbit.org):
> Hi,
>
> I was a bit shocked to find pkg_delete xm* wouldn't work, and that one has
> to type in the full name and version of the file, or I'm missing
> something...
>
> So I whipped togetherthis dreadful script (shame!) and was wondering if
> someone could improve it for me? I new to shell scripting...
>
> # cat /usr/local/bin/pkgdelete
> #!/usr/local/bin/bash
>
> if [ ! $1 ]; then
> echo "please enter partial package name"
> else
> match=`pkg_info | awk '{print $1}' | grep $1`
> matches=`echo $match | wc -w | sed -e "s/[ ]*[ ]*//"`