Skip to contentSkip to conversation

dracut [PATCH] Parameter expansion occurs before command evaluation.

PATCH Applied John Reiser 2 participants 2 messages Sep 23, 2011 – Sep 30, 2011 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

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.

Signature · 1 line
John Reiser, jreiser-L8/tzxVKHrlWk0Htik3J/[email protected]

From 507ad6f66fc66f868a9e5fdd3806e012c4022baa Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser-L8/tzxVKHrlWk0Htik3J/[email protected]>
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(-)
dracut-functions +1 -1
index 5508809..c4f7f61 100755
@@ -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%/*}
Signature · 1 line
1.7.6

A message that is not in the archive (sent off-list or not yet received): 4E7C9F7F.7010601-Po6cBsTGB2ZWk0Htik3J/[email protected]

Applied
#2 lore raw
Quoted 5 lines · John Reiser

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.

pushed to temporary http://git.surfsite.org/dracut.git

Thanks!