public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: elfutils-devel@sourceware.org
Subject: [PATCH] config: simplify profile.*sh.in
Date: Mon, 17 Jan 2022 17:22:19 +0100	[thread overview]
Message-ID: <20220117162219.fqt7heu4j67fzq35@tarta.nabijaczleweli.xyz> (raw)

[-- Attachment #1: Type: text/plain, Size: 2491 bytes --]

1. Remove needless profile=@profile@
2. Simplify needless sh -c "cat glob 2>/dev/null"
   into cat glob 2>/dev/null
3. Use $( instead of ` under sh
4. Assign to D_U directly and either export it or unset it

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
Please keep me in CC, as I'm not subscribed

 config/profile.csh.in | 12 +++++-------
 config/profile.sh.in  | 11 ++---------
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/config/profile.csh.in b/config/profile.csh.in
index 01f7c2f2..2495aaa0 100644
--- a/config/profile.csh.in
+++ b/config/profile.csh.in
@@ -1,4 +1,3 @@
-
 # $HOME/.login* or similar files may first set $DEBUGINFOD_URLS.
 # If $DEBUGINFOD_URLS is not set there, we set it from system *.url files.
 # $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
@@ -6,11 +5,10 @@
 # such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.
 
 if (! $?DEBUGINFOD_URLS) then
-    set prefix="@prefix@"
-    set debuginfod_urls=`sh -c "cat @sysconfdir@/debuginfod/*.urls 2>/dev/null" | tr '\n' ' '`
-    if ( "$debuginfod_urls" != "" ) then
-        setenv DEBUGINFOD_URLS "$debuginfod_urls"
+    set DEBUGINFOD_URLS=`cat @sysconfdir@/debuginfod/*.urls 2>/dev/null | tr '\n' ' '`
+    if ( "$DEBUGINFOD_URLS" != "" ) then
+        setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
+    else
+        unset DEBUGINFOD_URLS
     endif
-    unset debuginfod_urls
-    unset prefix
 endif
diff --git a/config/profile.sh.in b/config/profile.sh.in
index afce3963..1fc6d6ed 100644
--- a/config/profile.sh.in
+++ b/config/profile.sh.in
@@ -1,4 +1,3 @@
-
 # $HOME/.profile* or similar files may first set $DEBUGINFOD_URLS.
 # If $DEBUGINFOD_URLS is not set there, we set it from system *.url files.
 # $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
@@ -6,12 +5,6 @@
 # such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.
 
 if [ -z "$DEBUGINFOD_URLS" ]; then
-    prefix="@prefix@"
-    debuginfod_urls=`sh -c "cat @sysconfdir@/debuginfod/*.urls 2>/dev/null" | tr '\n' ' '`
-    if [ -n "$debuginfod_urls" ]; then
-        DEBUGINFOD_URLS="$debuginfod_urls"
-        export DEBUGINFOD_URLS
-    fi
-    unset debuginfod_urls
-    unset prefix
+    DEBUGINFOD_URLS=$(cat @sysconfdir@/debuginfod/*.urls 2>/dev/null | tr '\n' ' ')
+    [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS
 fi
-- 
2.34.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2022-01-17 16:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 16:22 наб [this message]
2022-01-18 16:13 ` Frank Ch. Eigler
2022-01-19 12:31   ` [PATCH v2] " наб
2022-04-15 11:48     ` Mark Wielaard
2022-04-15 12:12       ` наб
2022-04-23  0:32         ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220117162219.fqt7heu4j67fzq35@tarta.nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).