variable assignment / command substitution

Martinb_ARM_NOMMU_KISSDVD martinb at zeelandnet.nl
Tue Jan 15 21:35:54 UTC 2008


Same problem for me
I was thinking it was related to hush
i did made a post to vda but i did not post to the list because i was not
sure its a real bug
I wil paste my message again to the list and i hope someone is able to fix
this
(this does break all my scripting so i still cant use the 1.9.0 hush)

/paste
if i have the folowing script:
#!/bin/hush
export TVOFF=`echo hallo`
echo $TVOFF

and i do run strace on the new (1e) and the old (2e) i see:

/hdd/newscript # strace ./test4
execve("./test4", ["./test4"], [/* 7 vars */]) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1ccf000
getcwd("/hdd/newscript", 192) = 15
old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cd0000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cd2000
open("./test4", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TCGETS, 0x11fede8) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "#!/bin/hush \n\nexport TVOFF=`echo"..., 4096) = 54
wait4(-1, 0x11fedb4, WNOHANG|WUNTRACED, NULL) = -1 ECHILD (No child
processes)
dup2(1, 1) = 1
write(1, "`echo\n", 6`echo
) = 6
wait4(-1, 0x11fedb4, WNOHANG|WUNTRACED, NULL) = -1 ECHILD (No child
processes)
read(3, "", 4096) = 0
_exit(0) = ?





/hdd/newscript # strace ./test5
execve("./test5", ["./test5"], [/* 7 vars */]) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cce000
old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cd1000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cd4000
getcwd("/hdd/newscript", 4097) = 15
old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cd5000
open("/etc/profile", O_RDONLY) = 3
ioctl(3, TCGETS, 0x15c1de0) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "# ~/.bashrc: executed by bash(1)"..., 4096) = 159
wait4(-1, 0x15c1d9c, WNOHANG|WUNTRACED, NULL) = -1 ECHILD (No child
processes)
read(3, "", 4096) = 0
close(3) = 0
open("./test5", O_RDONLY) = 3
ioctl(3, TCGETS, 0x15c1dd8) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "#!/hdd/newscript/hush \n\nexport T"..., 4096) = 64
pipe([4, 5]) = 0
vfork() = 73
--- SIGCHLD (Child exited) @ 0 (0) ---
close(5) = 0
fcntl(4, F_GETFL) = 0 (flags O_RDONLY)
old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cb2000
ioctl(4, TCGETS, 0x15c1cb0) = -1 EINVAL (Invalid argument)
read(4, "hallo\n", 4096) = 6
read(4, "", 4096) = 0
close(4) = 0
wait4(-1, [WIFEXITED(s) && WEXITSTATUS(s) == 0], WNOHANG|WUNTRACED, NULL) =
73
wait4(-1, 0x15c1d9c, WNOHANG|WUNTRACED, NULL) = -1 ECHILD (No child
processes)
vfork() = 75
wait4(-1, hallo
[WIFEXITED(s) && WEXITSTATUS(s) == 0], WUNTRACED, NULL) = 75
--- SIGCHLD (Child exited) @ 0 (0) ---
wait4(-1, 0x15c1d9c, WNOHANG|WUNTRACED, NULL) = -1 ECHILD (No child
processes)
read(3, "", 4096) = 0
_exit(0)
/end

-----Oorspronkelijk bericht-----
Van: busybox-bounces at busybox.net [mailto:busybox-bounces at busybox.net]Namens
Ryan Raasch
Verzonden: dinsdag 15 januari 2008 21:53
Aan: busybox at busybox.net
Onderwerp: variable assignment / command substitution


Hello,

I am using busybox v1.9.0, and I am trying to parse the /proc/cmdline, but
the command substitutions/variable assignments do not seem to work

     cat /proc/cmdline | grep nfsroot

within a shell script (using ash), the above works, but when i do the
following


     NFSROOT=`cat /proc/cmdline | grep nfsroot`
     echo $NFSROOT

it does NOT work, i.e. nothing is assigned to NFSROOT.

Everything works on the host machine (bash). Thanks.




More information about the busybox mailing list