Tiny Core Linux

General TC => Remasters / Remixes - Unofficial => Topic started by: kzpm on August 20, 2013, 02:05:35 PM

Title: Bash code messes up at reamaster run-time
Post by: kzpm on August 20, 2013, 02:05:35 PM
Hi tc-ers!

I'm still busy to fine-tune a remaster webkiosk based on TinyCore-current.iso

For remote administration purposes, I want to collect remote ip's from users.
The script to extract the remote IP is as follows
Code: [Select]
cd /home/tc/.X.d/

cat >> get_remote_ip << STOP
#!/bin/sh
..
result="$(wget -q -O - http://checkip.dyndns.org)"
wait $!
..
exit
STOP
chmod a+x get_remote_ip

When checking the script while the remaster is in operation, it looks like the script commands starting with "result" and "wait" are distorted.
It shows only
"result=" and "wait="
All instructions after the "=" operator vanished..

What is the best way according to you, to retain these commands at runtime?

Kind regards,

kzpm

Title: Re: Bash code messes up at reamaster run-time
Post by: gerald_clark on August 20, 2013, 02:16:16 PM
Your $() and $! are being evaluated not copied.
If you want the lines copied, quote the $ characters.
Ex: \$(

Also, don't double post.
Title: Re: Bash code messes up at reamaster run-time
Post by: kzpm on August 20, 2013, 02:39:04 PM
Thanks Gerald_clark!

I removed my post already on the "wrong" forum. It was not my intention to double post..

Regards,
Kzpm
Title: Re: Bash code messes up at reamaster run-time
Post by: curaga on August 21, 2013, 02:34:02 AM
As an alternative, quote your EOF marker.  cat > file << "EOF"