Bug#577116: apt: dselect/install use readable POSIX $() instead of backtics
Package: apt
Version: 0.7.25.3
Severity: wishlist
Tags: patch
The following patch is against bzr repository to suggest using POSIX
$() command substitutions for now used backtics. The benefits:
1) redability
echo this `sed 's/some/thing/'`
=>
echo this $(sed 's/some/thing/')
2) safe
$() can be easily nested
2) fonts: on a small 10 inch netbook the backtics are difficult to
distinguish from other charatcers.
3) typing. In non-US keyboard the backtics are not in so convenient
location. Accessing the backtick requires acrobatic skills with
a combination of AltGr + KEY + SPACE
-- Package-specific info:
-- (/etc/apt/preferences present, but not submitted) --
-- (/etc/apt/sources.list present, but not submitted) --
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages apt depends on:
ii debian-archive-keyring 2009.01.31 GnuPG archive keys of the Debian a
ii libc6 2.10.2-6 Embedded GNU C Library: Shared lib
ii libgcc1 1:4.4.2-9 GCC support library
ii libstdc++6 4.4.2-9 The GNU Standard C++ Library v3
apt recommends no packages.
Versions of packages apt suggests:
pn apt-doc <none> (no description available)
pn aptitude | synaptic | wajig <none> (no description available)
ii bzip2 1.0.5-4 high-quality block-sorting file co
ii dpkg-dev 1.15.5.6 Debian package development tools
ii lzma 4.43-14 Compression method of 7z format in
ii python-apt 0.7.94.2 Python interface to libapt-pkg
-- no debconf information
>From aa7d6e1d4015df06f64fed5563d6276a21a3abc0 Mon Sep 17 00:00:00 2001
From: Jari Aalto <jari.aalto@cante.net>
Date: Fri, 9 Apr 2010 21:47:03 +0300
Subject: [PATCH 1/2] dselect/install: use readable POSIX $() command substitution
Organization: Private
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
dselect/install | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dselect/install b/dselect/install
index d9d6651..5851999 100755
--- a/dselect/install
+++ b/dselect/install
@@ -12,11 +12,11 @@ DPKG_OPTS="--admindir=$1"
APT_OPT0="-oDir::State::status=$1/status"
APT_OPT1="-oDPkg::Options::=$DPKG_OPTS"
set -e
-RES=`apt-config shell CLEAN DSelect::Clean OPTS DSelect::Options \
+RES=$(apt-config shell CLEAN DSelect::Clean OPTS DSelect::Options \
DPKG Dir::Bin::dpkg/f APTGET Dir::Bin::apt-get/f \
ARCHIVES Dir::Cache::Archives/d \
WAIT DSelect::WaitAfterDownload/b \
- CHECKDIR DSelect::CheckDir/b`
+ CHECKDIR DSelect::CheckDir/b)
eval $RES
set +e
@@ -64,12 +64,12 @@ fi
# Finished OK
if [ $RES -eq 0 ]; then
- if [ `ls $ARCHIVES $ARCHIVES/partial | egrep -v "^lock$|^partial$" | wc -l` \
+ if [ $(ls $ARCHIVES $ARCHIVES/partial | egrep -v "^lock$|^partial$" | wc -l) \
-eq 0 ]; then
exit 0
fi
- NEWLS=`ls -ld $ARCHIVES`
+ NEWLS=$(ls -ld $ARCHIVES)
if [ x$CHECKDIR = "xtrue" ]; then
if [ "x$OLDLS" = "x$NEWLS" ]; then
exit 0
@@ -77,7 +77,7 @@ if [ $RES -eq 0 ]; then
fi
# Check the cleaning mode
- case `echo $CLEAN | tr '[:upper:]' '[:lower:]'` in
+ case $(echo $CLEAN | tr '[:upper:]' '[:lower:]') in
auto)
$APTGET "$APT_OPT0" "$APT_OPT1" autoclean &&
echo $"Press enter to continue." && read RES && exit 0;
@@ -88,7 +88,7 @@ if [ $RES -eq 0 ]; then
;;
prompt)
exec 3>&1
- if [ `yesno $"Do you want to erase any previously downloaded .deb files?" y` = y ]; then
+ if [ $(yesno $"Do you want to erase any previously downloaded .deb files?" y) = y ]; then
$APTGET "$APT_OPT0" "$APT_OPT1" clean &&
echo $"Press enter to continue." && read RES && exit 0;
fi
--
1.7.0
Reply to: