0
vinski

strange command execution via variable

Recommended Posts

Dear Armbian community

I am currently porting some project from Debian/amd64 to Armbian (Debian GNU/Linux7 Wheezy) with shell and python and its impressive !

I though noticed strange behaviour on some command execution via variable and will here focus on a simple date sync example :

1. nc command :

from shell or from script : nc time.nist.gov 13 revert a typical 46 char long ASCII answer.

via a variable, a=$(nc time.nist.gov 13) ; $a delivers the same time server answer followed by the list of dir & files in the current dir, space separated.

   explicit error $a | hexdump -v -C

2. date command

from the shell or from script : date +%T -s "12:34:56" , properly sets the system time.

via a variable, a=$(date +%T -s "12:34:56") ; $a generates an invalid date "12:34:56"  error

   explicit error : $a 2>&1 | hexdump -v -C

 

Does anyone confirm this behaviour ? Is it documented ? patched ?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0