-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Size of Variable reporting inaccurate? #7
Comments
Thank you for the feedback. Looks like wc is counting the return or extra line? I updated the code to account for the extra character.
I'll do more searching online to see how others have resolved the issue. |
Yes it's just because the string returned by "nvram get" is terminated with a linefeed.
|
I now use the following (having been prompted by you to review my code to make it POSIX complaint and more efficient ;-) `NVRAM_DATA=$(nvram get "$NVRAM_VAR") NVRAM_DATA_SIZE=${#NVRAM_DATA}` although previously I used the slower (i.e. calling an external utility) |
Minor quibble for a variable of length 2999
'wc -m' or 'wc -c' appears to incorrectly report the NVRAM variable?
e.g.
echo $(nvram get jffs2_on)
1
Now print the size using your method
echo $(nvram get jffs2_on | wc -m)
2
The text was updated successfully, but these errors were encountered: