From: John Reiser <jreiser-Po6cBsTGB2ZWk0Htik3J/w@public.gmane.org>
To: harald-2VeQXyDyezErK2HsEjNOmQ@public.gmane.org
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: dracut [PATCH] Parameter expansion occurs before command evaluation.
Date: Fri, 23 Sep 2011 08:02:23 -0700 [thread overview]
Message-ID: <4E7C9F7F.7010601@bitwagon.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
Bash shell expands all ${parameter} before evaluating a command.
For multiple declarations and assignments within the same 'local' command,
then new variables or new values that appear towards the left
do not affect parameter expansion towards the right.
--
John Reiser, jreiser-L8/tzxVKHrlWk0Htik3J/w@public.gmane.org
[-- Attachment #2: 0001-Parameter-expansion-occurs-before-command-evaluation.patch --]
[-- Type: text/plain, Size: 896 bytes --]
From 507ad6f66fc66f868a9e5fdd3806e012c4022baa Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser-L8/tzxVKHrlWk0Htik3J/w@public.gmane.org>
Date: Fri, 23 Sep 2011 07:37:43 -0700
Subject: [PATCH] Parameter expansion occurs before command evaluation.
${parameter} on the right is expanded before evaluating "local var=value"
on the left.
---
dracut-functions | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 5508809..c4f7f61 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -272,7 +272,7 @@ check_vol_slaves() {
inst_dir() {
[[ -e ${initdir}"$1" ]] && return 0 # already there
- local _dir="$1" _part=${_dir%/*} _file
+ local _dir="$1" _part="${1%/*}" _file
while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}${_part}" ]]; do
_dir="$_part $_dir"
_part=${_part%/*}
--
1.7.6
next reply other threads:[~2011-09-23 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-23 15:02 John Reiser [this message]
[not found] ` <4E7C9F7F.7010601-Po6cBsTGB2ZWk0Htik3J/w@public.gmane.org>
2011-09-30 11:35 ` dracut [PATCH] Parameter expansion occurs before command evaluation Harald Hoyer
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=4E7C9F7F.7010601@bitwagon.com \
--to=jreiser-po6cbstgb2zwk0htik3j/w@public.gmane.org \
--cc=harald-2VeQXyDyezErK2HsEjNOmQ@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.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