config: simplify profile.*sh.in
Commit Message
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(-)
Comments
Hi -
> 1. Remove needless profile=@profile@
You mean "prefix=@prefix@". And it's not needless,
because @sysconfdir@ often expands to "$prefix/something",
which requires a prefix var to be set for evaluation.
> 2. Simplify needless sh -c "cat glob 2>/dev/null"
> into cat glob 2>/dev/null
This is not needless, but I forget the exact details. It probably has
to do with the $prefix expansion just above, or perhaps glob
non-matching error handling.
> 3. Use $( instead of ` under sh
I'm neutral on this, assuming it's not a bashism.
> 4. Assign to D_U directly and either export it or unset it
I'm neutral on this.
- FChE
@@ -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
@@ -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