WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Bash code messes up at reamaster run-time  (Read 1646 times)

Offline kzpm

  • WikiUser
  • *
  • Posts: 16
Bash code messes up at reamaster run-time
« 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


Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Bash code messes up at reamaster run-time
« Reply #1 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.

Offline kzpm

  • WikiUser
  • *
  • Posts: 16
Re: Bash code messes up at reamaster run-time
« Reply #2 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

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 9971
Re: Bash code messes up at reamaster run-time
« Reply #3 on: August 21, 2013, 02:34:02 AM »
As an alternative, quote your EOF marker.  cat > file << "EOF"
The only barriers that can stop you are the ones you create yourself.