[nautilus-actions] Replace basename command with a shell substitution
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Replace basename command with a shell substitution
- Date: Fri, 21 Jan 2011 18:36:39 +0000 (UTC)
commit ea221a8d892d2c35bc0d27b35ba5142aec9671e9
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Jan 20 18:56:35 2011 +0100
Replace basename command with a shell substitution
+ src/utils/na-gconf2key.sh.in
+ tools/check-headers.sh
+ tools/check-po.sh
+ tools/init-finalize-diff.sh
+ tools/release-tarball.sh
ChangeLog | 8 ++++++++
src/utils/na-gconf2key.sh.in | 8 ++++----
tools/check-headers.sh | 2 +-
tools/check-po.sh | 2 +-
tools/init-finalize-diff.sh | 16 ++++++++--------
tools/release-tarball.sh | 2 +-
6 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b34c1e5..d1cbb65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-20 Pierre Wieser <pwieser trychlos org>
+
+ * src/utils/na-gconf2key.sh.in:
+ * tools/check-headers.sh:
+ * tools/check-po.sh:
+ * tools/init-finalize-diff.sh:
+ * tools/release-tarball.sh: Replace basename with a shell substitution.
+
2011-01-19 Pierre Wieser <pwieser trychlos org>
* tools/release-tarball.sh: Full script rewrite.
diff --git a/src/utils/na-gconf2key.sh.in b/src/utils/na-gconf2key.sh.in
index 27a4e44..cefac0b 100644
--- a/src/utils/na-gconf2key.sh.in
+++ b/src/utils/na-gconf2key.sh.in
@@ -31,7 +31,7 @@ errs=0 # will be the exit code of the script
my_cmd="${0}" # e.g. "./make-ks.sh"
my_parms="$*" # e.g. "-host toaster"
my_cmdline="${my_cmd} ${my_parms}"
-me="$(basename ${my_cmd})" # e.g. "make-ks.sh"
+me="${my_cmd##*/}" # e.g. "make-ks.sh"
# used in msg and msgerr functions
my_tmproot="/tmp/$(echo ${me} | sed 's?\..*$??').$$"
# e.g. "/tmp/make-ks.1978"
@@ -408,7 +408,7 @@ let nbitems=0
# each object, action or menu, is then exported in .a .desktop format
# to be written to its .desktop file
for dir in $(gconftool-2 --all-dirs ${na_configurations}); do
- id=$(basename ${dir})
+ id=${dir##*/}
let nbitems+=1
[ "${opt_verbose}" = "yes" ] && msg "item=${id}"
if [ -e ${opt_dir}/${id}.desktop -a "${opt_force}" = "no" ]; then
@@ -588,7 +588,7 @@ done
# /apps/nautilus-actions/mandatory/<provider_id>/locked -> [io-provider <provider_id>]
if [ $(id -u) -eq 0 ]; then
for dir in $(gconftool-2 --all-dirs ${na_mandatory}); do
- bdir=$(basename ${dir})
+ bdir=${dir##*/}
if [ "${bdir}" != "na-gconf" ]; then
value=$(gconftool-2 --get ${dir}/locked 2>/dev/null)
if [ "${value}" != "" ]; then
@@ -613,7 +613,7 @@ fi
# migrate io-providers keys
# fully disabling (not reconducting its keys)
for dir in $(gconftool-2 --all-dirs ${na_providers}); do
- bdir=$(basename ${dir})
+ bdir=${dir##*/}
if [ "${bdir}" != "na-gconf" ]; then
gconftool-2 --all-entries ${dir} | while read key x value; do
case ${key} in
diff --git a/tools/check-headers.sh b/tools/check-headers.sh
index aced312..b44cb6e 100755
--- a/tools/check-headers.sh
+++ b/tools/check-headers.sh
@@ -31,7 +31,7 @@ errs=0 # will be the exit code of the script
my_cmd="${0}" # e.g. "./make-ks.sh"
my_parms="$*" # e.g. "-host toaster"
my_cmdline="${my_cmd} ${my_parms}"
-me="$(basename ${my_cmd})" # e.g. "make-ks.sh"
+me="${my_cmd##*/}" # e.g. "make-ks.sh"
# used in msg and msgerr functions
my_tmproot="/tmp/$(echo ${me} | sed 's?\..*$??').$$"
# e.g. "/tmp/make-ks.1978"
diff --git a/tools/check-po.sh b/tools/check-po.sh
index 3db812f..6ef92c9 100755
--- a/tools/check-po.sh
+++ b/tools/check-po.sh
@@ -31,7 +31,7 @@ errs=0 # will be the exit code of the script
my_cmd="${0}" # e.g. "./make-ks.sh"
my_parms="$*" # e.g. "-host toaster"
my_cmdline="${my_cmd} ${my_parms}"
-me="$(basename ${my_cmd})" # e.g. "make-ks.sh"
+me="${my_cmd##*/}" # e.g. "make-ks.sh"
# used in msg and msgerr functions
my_tmproot="/tmp/$(echo ${me} | sed 's?\..*$??').$$"
# e.g. "/tmp/make-ks.1978"
diff --git a/tools/init-finalize-diff.sh b/tools/init-finalize-diff.sh
index eff26bf..86ae174 100755
--- a/tools/init-finalize-diff.sh
+++ b/tools/init-finalize-diff.sh
@@ -32,16 +32,16 @@ fi
check_for="finalize"
-tmp1=/tmp/$(basename $0).$$.1
-tmp2=/tmp/$(basename $0).$$.2
-tmp3=/tmp/$(basename $0).$$.3
+tmp1=/tmp/${0##*/}.$$.1
+tmp2=/tmp/${0##*/}.$$.2
+tmp3=/tmp/${0##*/}.$$.3
-\rm -f /tmp/$(basename $0).*
+\rm -f /tmp/${0##*/}.*
echo ""
function getftmp
{
- echo /tmp/$(basename $0).$$.${1}
+ echo /tmp/${0##*/}.$$.${1}
}
function str_init
@@ -84,7 +84,7 @@ function count_display
function is_reused
{
- typeset fused=/tmp/$(basename $0).$$.reused
+ typeset fused=/tmp/${0##*/}.$$.reused
typeset triplet="${1}"
typeset -i count=0
@@ -223,7 +223,7 @@ cat ${tmp2} | while read line; do
fi
fi
fi
- echo "${line_init}" > /tmp/$(basename $0).$$.line_init
+ echo "${line_init}" > /tmp/${0##*/}.$$.line_init
done
# does not work because shell variables do not go out of a while loop in bash
#if [ "${line_init}" != "" ]; then
@@ -238,7 +238,7 @@ done
# count_inc count_undisposed_bis
# fi
#fi
-line_init="$(cat /tmp/$(basename $0).$$.line_init)"
+line_init="$(cat /tmp/${0##*/}.$$.line_init)"
if [ "${line_init}" != "" ]; then
obj_address_init=$(echo "${line_init}" | awk '{ print $3 }')
class=$(echo "${line_init}" | awk '{ print $4 }')
diff --git a/tools/release-tarball.sh b/tools/release-tarball.sh
index b66d864..773ac54 100755
--- a/tools/release-tarball.sh
+++ b/tools/release-tarball.sh
@@ -31,7 +31,7 @@ errs=0 # will be the exit code of the script
my_cmd="${0}" # e.g. "./make-ks.sh"
my_parms="$*" # e.g. "-host toaster"
my_cmdline="${my_cmd} ${my_parms}"
-me="$(basename ${my_cmd})" # e.g. "make-ks.sh"
+me="${my_cmd##*/}" # e.g. "make-ks.sh"
# used in msg and msgerr functions
my_tmproot="/tmp/$(echo ${me} | sed 's?\..*$??').$$"
# e.g. "/tmp/make-ks.1978"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]