LinuxQuestions.org
Review your favorite Linux distribution.
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
 
LinkBack Search this Thread
Old 09-19-2013, 03:37 AM   #1
waddles
Member
 
Registered: Sep 2012
Posts: 373

Rep: Reputation: 0
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
Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 727

Rep: Reputation: 166Reputation: 166
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
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,286

Rep: Reputation: 802Reputation: 802Reputation: 802Reputation: 802Reputation: 802Reputation: 802Reputation: 802
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: 373

Original Poster
Rep: Reputation: 0
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
Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 727

Rep: Reputation: 166Reputation: 166
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: 373

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are 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


All times are GMT -5. The time now is 03:57 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration