mint-bash weirdness

D. Hugh Redelmeier hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Fri Jan 3 22:22:32 UTC 2014


| From: Giles Orr <gilesorr-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>

| function dpkgs () { dpkg-query -W
| --showformat='${Installed-Size}\t${Package}\n' | sort -n; }
| 
|   No problem with Debian, I just drop the
| function into /etc/bash.bashrc as usual.  But on Mint it just prints:
| 
| Size
| Size
| Size

[all the following is unreliable guess-work.]

Shell variables don't normally had - in them.  Try the following:
	echo ${yuck-zop}
That should print "zop".  I think that this is an undocumented
backward compatability feature of bash.  See sh(1), page 159, in
  <http://plan9.bell-labs.com/7thEdMan/v7vol1.pdf>

Now your usage should not involve shell parameter substitution but
dpkg-query --showformat substitution.  But if the single quotes were
somehow eaten, the shell would do the substitution and "Size" would be
printed.

If you do the command
	set | less
and search for dpkgs, you should see what definition bash has.

I see:
    dpkgs () 
    { 
	dpkg-query -W --showformat='${Installed-Size}\t${Package}\n' | sort -n
    }
which looks correct (see the quotes?).

I suspect that on the problematic system (Mint), those quotes are gone.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list