LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-19-2013, 03:37 AM   #1
waddles
Member
 
Registered: Sep 2012
Posts: 372

Rep: Reputation: 1
Trying to find meaning of command with ½


I do not recognize what the command line with ???? means.
Can someone explain it to me.
Code:
OUT=`curl -m 2 --range 0-0 $URL 2> /dev/null|while read -n 1 C
do
  OUT="${OUT}½"   # ????
  echo $OUT
  [ ${#OUT} -gt 1 ] && break
done`
 
Old 09-19-2013, 05:43 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
This is an odd character and is not a command either the file is corrupt or you are using the wrong encoding try using 'cat' on the file as it usually gets the encoding right.
 
Old 09-19-2013, 07:13 AM   #3
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748
The way I read that code fragment is that the variable OUT gets 0xC20xBD appended if there is a file available at $URL.
Are we trying to hack our Nikes? Apparently those two bytes are used to specify a device address for a nRF24L01 ultra low power RF transceiver.
http://dmitry.gr/index.php?r=05.Proj...%20plus%20iPod
http://stackoverflow.com/questions/2...an-i-access-it

Last edited by allend; 09-19-2013 at 07:20 AM.
 
Old 09-19-2013, 08:24 AM   #4
waddles
Member
 
Registered: Sep 2012
Posts: 372

Original Poster
Rep: Reputation: 1
This is from a curl file splitting script:
http://splitcurl.googlecode.com/git/splitcurl
Those 2 characters appear there and when viewed with cat/vi.
This part of the script is testing for "splitness" which may be how evenly they are split??
Since the output is dumped to null and times out after 2 seconds and is examining the 1st byte, appending those characters to whatever is in COPY would guarantee the length ${#OUT} is greater than 1, regardless, wouldn't it?
Such logic if I have followed it correctly seems superfluous. Please correct me if I have done an injustice to the coder.
 
Old 09-19-2013, 09:07 AM   #5
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Quote:
Originally Posted by waddles View Post
...appending those characters to whatever is in COPY would guarantee the length ${#OUT} is greater than 1, regardless, wouldn't it?...
You could be right ( sorry should have looked at the whole code not just the odd character ), its common to add a character to a string in bash so that you don't get null string errors ie
Code:
if [ X${SOMESTRING} = "X" ];then
echo "String is empty or null but doesn't generate an error
fi
The two 'X's cancel out.

So the coder MAY have just tacked this character on to the end of the string in which case the string would be greater than one if curl had downloaded something and have a length of 1 if not, personally I would do a check for an empty/null string but that's just personal preference.

Try replacing the odd character with say 'X' and run the script if it behaves as it should then that is the reason for the odd character.
 
1 members found this post helpful.
Old 09-19-2013, 03:28 PM   #6
waddles
Member
 
Registered: Sep 2012
Posts: 372

Original Poster
Rep: Reputation: 1
Don't feel sorry Keith, initially I saw that as a string manipulation- dah!
I will be attempting to take UR advise.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how Command interpreter understand the meaning of command tushar_pandey Linux - Newbie 5 08-21-2012 04:25 PM
meaning of output of ldd command _Linux_Learner Linux - Newbie 3 11-16-2010 07:17 AM
linux command, meaning skylimit Linux - Newbie 9 01-22-2007 02:25 AM
command meaning ramrann Linux - Newbie 2 10-18-2005 01:56 PM
What Is The Meaning Of I386,i686 And Where I Can Find This Information pak_abdul Linux - Hardware 3 05-26-2005 10:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration